From a31d8c58101a3cc21fd52f3a817eadc0100cc48a Mon Sep 17 00:00:00 2001 From: CodeDoctorDE Date: Fri, 5 Aug 2022 11:32:34 +0200 Subject: [PATCH] Fix update-changelog --- .github/workflows/release.yml | 54 ++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cfc38a78b20..47a24ed351ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,8 +14,50 @@ on: required: false jobs: + update-changelog: + runs-on: ubuntu-22.04 + strategy: + matrix: + branch: + - develop + - main + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.CI_PAT }} + ref: ${{ matrix.branch }} + - name: Get flutter version + run: | + FLUTTER_VERSION=$(cat app/FLUTTER_VERSION) + echo "FLUTTER_VERSION=${FLUTTER_VERSION}" >> $GITHUB_ENV + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + channel: "stable" # or: 'beta' or 'dev' + - name: Setup git + id: setup + run: | + BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)" + [[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]] + BUTTERFLY_VERSION="${BASH_REMATCH[1]}" + echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV + BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}" + echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV + git config --global user.email "ci@linwood.dev" + git config --global user.name "Linwood CI" + - name: Update changelog + run: | + git fetch + git pull origin ${{ matrix.branch }} + dart pub get -C tools + dart run tools/set_version.dart --build-number keep ${{ env.BUTTERFLY_VERSION }} --changelog + git add . + git commit -m "Add changelog of v${{ github.event.inputs.next_version }}" + git push origin ${{ matrix.branch }} release: runs-on: ubuntu-22.04 + needs: + - update-changelog outputs: build_number: ${{ steps.setup.outputs.build_number }} steps: @@ -90,6 +132,7 @@ jobs: update-version: runs-on: ubuntu-22.04 needs: + - update-changelog - release steps: - uses: actions/checkout@v3 @@ -115,7 +158,7 @@ jobs: git config --global user.email "ci@linwood.dev" git config --global user.name "Linwood CI" - name: Set next version - if: ${{ github.event.inputs.stable != 'true' || github.ref != 'refs/heads/develop' }} + if: ${{ github.event.inputs.stable != 'true' || github.ref != 'refs/heads/develop' }} run: | git fetch git pull origin @@ -129,6 +172,7 @@ jobs: runs-on: ubuntu-22.04 needs: - release + - update-changelog - update-version steps: - uses: actions/checkout@v3 @@ -160,7 +204,7 @@ jobs: git commit -m "Update version number" git push origin main - name: Merge develop in main - if: ${{ github.event.inputs.stable == 'true' && github.ref == 'refs/heads/develop' }} + if: ${{ github.event.inputs.stable == 'true' && github.ref == 'refs/heads/develop' }} run: | git fetch git pull @@ -181,6 +225,7 @@ jobs: if: ${{ github.ref == 'refs/heads/main' }} needs: - release + - update-changelog - update-version steps: - uses: actions/checkout@v3 @@ -234,9 +279,10 @@ jobs: git push origin develop set-next-version: runs-on: ubuntu-22.04 - if: ${{ github.event.inputs.stable == 'true' && github.ref == 'refs/heads/develop' }} + if: ${{ github.event.inputs.stable == 'true' && github.ref == 'refs/heads/develop' }} needs: - release + - update-changelog - update-version - update-main steps: @@ -325,4 +371,4 @@ jobs: # run: fastlane deploy # if: ${{ !github.event.inputs.stable }} # env: - # PLAY_STORE_UPLOAD_KEY: ${{ secrets.PLAY_STORE_UPLOAD_KEY }} \ No newline at end of file + # PLAY_STORE_UPLOAD_KEY: ${{ secrets.PLAY_STORE_UPLOAD_KEY }}