61 lines
1.8 KiB
YAML
61 lines
1.8 KiB
YAML
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 }}
|