feat: Added release workflow
This commit is contained in:
60
.github/workflows/release.yml
vendored
Normal file
60
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
name: "Release new version"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prerelease:
|
||||||
|
if: "${{ github.event.head_commit.message != 'chore: storing version and changelog' }}"
|
||||||
|
name: Preparing release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.DEPLOYMENT_TOKEN }}
|
||||||
|
- name: Calculate version
|
||||||
|
id: calculate_version
|
||||||
|
uses: mathieudutour/github-tag-action@v5.5
|
||||||
|
with:
|
||||||
|
tag_prefix: ""
|
||||||
|
github_token: ${{ secrets.DEPLOYMENT_TOKEN }}
|
||||||
|
dry_run: true
|
||||||
|
- name: "Write changelog"
|
||||||
|
run: |
|
||||||
|
CHANGELOG=""
|
||||||
|
if [ -e CHANGELOG.md ]
|
||||||
|
then
|
||||||
|
CHANGELOG=$(cat CHANGELOG.md)
|
||||||
|
fi
|
||||||
|
echo -e "${{steps.calculate_version.outputs.changelog}}\n\n${CHANGELOG}" > CHANGELOG.md
|
||||||
|
- name: "Commit"
|
||||||
|
uses: EndBug/add-and-commit@v7.2.1
|
||||||
|
with:
|
||||||
|
message: "chore: storing version and changelog"
|
||||||
|
push: true
|
||||||
|
release:
|
||||||
|
if: "${{ github.event.head_commit.message == 'chore: storing version and changelog' }}"
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.DEPLOYMENT_TOKEN }}
|
||||||
|
- name: Create version
|
||||||
|
id: create_version
|
||||||
|
uses: mathieudutour/github-tag-action@v5.5
|
||||||
|
with:
|
||||||
|
tag_prefix: ""
|
||||||
|
github_token: ${{ secrets.DEPLOYMENT_TOKEN }}
|
||||||
|
- name: Create a GitHub release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.DEPLOYMENT_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.create_version.outputs.new_tag }}
|
||||||
|
release_name: ${{ steps.create_version.outputs.new_tag }}
|
||||||
|
body: ${{ steps.create_version.outputs.changelog }}
|
||||||
Reference in New Issue
Block a user