Skip to content

Commit

Permalink
ci: move archive changelog to own job
Browse files Browse the repository at this point in the history
  • Loading branch information
RedCommander735 committed May 12, 2024
1 parent ba2c60c commit 098e5b4
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ on:
workflow_dispatch:

jobs:
archive-changelog:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main

- name: Save changelog
if: startsWith(github.ref, 'refs/tags/')
run: cp 'changelogs/CHANGELOG - latest.md' 'changelogs/CHANGELOG - ${{ github.ref_name }}.md'

- name: Commit changelog
if: startsWith(github.ref, 'refs/tags/')
run: |
git config --global user.name 'Github Actions'
git config --global user.email '[email protected]'
git add 'changelogs/CHANGELOG - ${{ github.ref_name }}.md'
git commit -am "Save changelog"
git push
build:
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -66,23 +89,10 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/${{ github.ref_name }}-release.apk

- name: Save changelog
if: startsWith(github.ref, 'refs/tags/')
run: cp 'changelogs/CHANGELOG - latest.md' 'changelogs/CHANGELOG - ${{ github.ref_name }}.md'

- name: Commit changelog
if: startsWith(github.ref, 'refs/tags/')
run: |
git config --global user.name 'Github Actions'
git config --global user.email '[email protected]'
git add 'changelogs/CHANGELOG - ${{ github.ref_name }}.md'
git commit -am "Save changelog"
git push
- name: Create Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: 'changelogs/CHANGELOG - ${{ github.ref_name }}.md'
body_path: 'changelogs/CHANGELOG - latest.md'
token: ${{ secrets.GITHUB_TOKEN }}
files: build/app/outputs/flutter-apk/${{ github.ref_name }}-release.apk

0 comments on commit 098e5b4

Please sign in to comment.