diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 143fe1d..a49244a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 '40245965+RedCommander735@users.noreply.github.com' + git add 'changelogs/CHANGELOG - ${{ github.ref_name }}.md' + git commit -am "Save changelog" + git push + build: runs-on: ubuntu-latest permissions: @@ -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 '40245965+RedCommander735@users.noreply.github.com' - 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