Include generated release notes in builds (#194)

* create release notes from workflow input

* temp disable releases

* force builds

* include release notes in builds

* enabled releases
This commit is contained in:
Vadim 2024-10-08 19:53:15 +02:00 committed by GitHub
parent 191959b12b
commit 4e5cbc7759
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 50 additions and 30 deletions

View file

@ -64,6 +64,8 @@ env:
BUILD_ARGS: --release --flavor ${{ inputs.flavor }} -t lib/main_${{ inputs.flavor }}.dart BUILD_ARGS: --release --flavor ${{ inputs.flavor }} -t lib/main_${{ inputs.flavor }}.dart
BUILD_APK_PATH: build/app/outputs/flutter-apk/app-${{ inputs.flavor }}-release.apk BUILD_APK_PATH: build/app/outputs/flutter-apk/app-${{ inputs.flavor }}-release.apk
BUILD_AAB_PATH: build/app/outputs/bundle/${{ inputs.flavor }}Release/app-${{ inputs.flavor }}-release.aab BUILD_AAB_PATH: build/app/outputs/bundle/${{ inputs.flavor }}Release/app-${{ inputs.flavor }}-release.aab
RELEASE_NOTES_ARTIFACT_NAME: release_notes_en_${{ inputs.version }}
RELEASE_NOTES_PATH: "assets/release_notes"
jobs: jobs:
build-android: build-android:
@ -109,6 +111,12 @@ jobs:
- name: Increment build number & replace version number - name: Increment build number & replace version number
run: bash ./.github/scripts/increment_build_number.sh ${{ github.event.inputs.version }} run: bash ./.github/scripts/increment_build_number.sh ${{ github.event.inputs.version }}
- name: Download release notes
uses: actions/download-artifact@v3
with:
name: ${{ env.RELEASE_NOTES_ARTIFACT_NAME }}
path: ${{ env.RELEASE_NOTES_PATH }}
- name: Install Flutter - name: Install Flutter
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2
with: with:

View file

@ -39,6 +39,8 @@ on:
env: env:
FLAVOR: "prod" FLAVOR: "prod"
RELEASE_NOTES_ARTIFACT_NAME: release_notes_en_${{ inputs.version }}
RELEASE_NOTES_PATH: "assets/release_notes"
jobs: jobs:
build: build:
@ -104,6 +106,12 @@ jobs:
- name: Increment build number & replace version number - name: Increment build number & replace version number
run: bash ./.github/scripts/increment_build_number.sh ${{ github.event.inputs.version }} run: bash ./.github/scripts/increment_build_number.sh ${{ github.event.inputs.version }}
- name: Download release notes
uses: actions/download-artifact@v3
with:
name: ${{ env.RELEASE_NOTES_ARTIFACT_NAME }}
path: ${{ env.RELEASE_NOTES_PATH }}
- name: Install Flutter - name: Install Flutter
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2
with: with:

View file

@ -29,7 +29,9 @@ on:
default: true default: true
env: env:
RELEASE_NOTES_FILE: release_notes_en_${{ inputs.version }} RELEASE_NOTES_ARTIFACT_NAME: release_notes_en_${{ inputs.version }}
RELEASE_NOTES_FILE: release_notes_en_${{ inputs.version }}.md
RELEASE_NOTES_PATH: "assets/release_notes"
jobs: jobs:
run-integration-tests: run-integration-tests:
@ -38,9 +40,25 @@ jobs:
uses: ./.github/workflows/run_integration_tests.yml uses: ./.github/workflows/run_integration_tests.yml
secrets: inherit secrets: inherit
generate-release-notes:
name: Generate release notes
needs: [run-integration-tests]
if: ${{ always() && !failure() && !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Generate release notes
run: |
echo ${{ inputs.release-notes }} > ${{ env.RELEASE_NOTES_FILE }}
perl -i -pe 's/\s{1}(-{1})/\n$1/g' ${{ env.RELEASE_NOTES_FILE }}
- name: Upload merged_native_libs.zip to artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_NOTES_ARTIFACT_NAME }}
path: ${{ env.RELEASE_NOTES_FILE }}
build-android: build-android:
name: Build Android name: Build Android
needs: [run-integration-tests] needs: [generate-release-notes]
if: ${{ always() && !failure() && !cancelled() }} if: ${{ always() && !failure() && !cancelled() }}
strategy: strategy:
matrix: matrix:
@ -55,7 +73,7 @@ jobs:
build-ios: build-ios:
name: Build iOS name: Build iOS
needs: [run-integration-tests] needs: [generate-release-notes]
if: ${{ always() && !failure() && !cancelled() }} if: ${{ always() && !failure() && !cancelled() }}
uses: ./.github/workflows/build_ipa.yml uses: ./.github/workflows/build_ipa.yml
secrets: inherit secrets: inherit
@ -63,24 +81,10 @@ jobs:
stage-backend: false stage-backend: false
version: ${{ inputs.version }} version: ${{ inputs.version }}
generate-release-notes:
name: Generate release notes
needs: [build-android, build-ios]
runs-on: ubuntu-latest
steps:
- name: Generate release notes
run: |
echo ${{ inputs.release-notes }} > ${{ env.RELEASE_NOTES_FILE }}.md
perl -i -pe 's/\s{1}(-{1})/\n$1/g' ${{ env.RELEASE_NOTES_FILE }}.md
- name: Upload merged_native_libs.zip to artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_NOTES_FILE }}
path: ${{ env.RELEASE_NOTES_FILE }}.md
create-github-release: create-github-release:
name: Create Github release name: Create Github release
needs: [generate-release-notes] needs: [build-android, build-ios]
if: ${{ always() && !failure() && !cancelled() }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
@ -95,10 +99,8 @@ jobs:
- name: Download release notes - name: Download release notes
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: ${{ env.RELEASE_NOTES_FILE }} name: ${{ env.RELEASE_NOTES_ARTIFACT_NAME }}
path: ${{ env.RELEASE_NOTES_PATH }}
- name: Move release notes to a folder
run: mv assets/release_notes/${{ env.RELEASE_NOTES_FILE }}.md ${{ env.RELEASE_NOTES_FILE }}
- name: Commit changes - name: Commit changes
run: | run: |
@ -127,11 +129,12 @@ jobs:
artifacts: "m3_lightmeter.apk" artifacts: "m3_lightmeter.apk"
skipIfReleaseExists: true skipIfReleaseExists: true
tag: "v${{ github.event.inputs.version }}" tag: "v${{ github.event.inputs.version }}"
bodyFile: "${{ env.RELEASE_NOTES_FILE }}.md" bodyFile: "${{ env.RELEASE_NOTES_PATH }}/${{ env.RELEASE_NOTES_FILE }}"
create-google-play-release: create-google-play-release:
name: Create Google Play release name: Create Google Play release
needs: [generate-release-notes] needs: [build-android, build-ios]
if: ${{ always() && !failure() && !cancelled() }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -151,13 +154,13 @@ jobs:
- name: Download release notes - name: Download release notes
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: ${{ env.RELEASE_NOTES_FILE }} name: ${{ env.RELEASE_NOTES_ARTIFACT_NAME }}
- name: Move release notes to a folder - name: Move release notes to a folder
run: | run: |
mv assets/release_notes/${{ env.RELEASE_NOTES_FILE }}.md ${{ env.RELEASE_NOTES_FILE }} mv ${{ env.RELEASE_NOTES_FILE }} whatsnew-en-US
mkdir whatsnew mkdir whatsnew
mv ${{ env.RELEASE_NOTES_FILE }} whatsnew mv whatsnew-en-US whatsnew
# https://unix.stackexchange.com/questions/13466/can-grep-output-only-specified-groupings-that-match' # https://unix.stackexchange.com/questions/13466/can-grep-output-only-specified-groupings-that-match'
# https://stackoverflow.com/questions/74353311/github-workflow-unable-to-process-file-command-env-successfully # https://stackoverflow.com/questions/74353311/github-workflow-unable-to-process-file-command-env-successfully
@ -182,7 +185,8 @@ jobs:
upload-to-app-store: upload-to-app-store:
name: Upload to App Store name: Upload to App Store
needs: [generate-release-notes] needs: [build-android, build-ios]
if: ${{ always() && !failure() && !cancelled() }}
runs-on: macos-13 runs-on: macos-13
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -212,4 +216,4 @@ jobs:
m3_lightmeter_apk m3_lightmeter_apk
m3_lightmeter_appbundle m3_lightmeter_appbundle
m3_lightmeter_ipa m3_lightmeter_ipa
${{ env.RELEASE_NOTES_FILE }} ${{ env.RELEASE_NOTES_ARTIFACT_NAME }}