Release #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # TODO: auto release the version before VERSION is updated | |
| # TODO: publish to | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| commit_sha: | |
| required: false | |
| type: string | |
| description: Override the ref used for this release | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| prepare_release: | |
| permissions: | |
| contents: write | |
| name: Prepare Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| changelog: ${{ steps.extract-changelog.outputs.markdown }} | |
| assets: ${{ steps.release.outputs.assets }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| if: "${{ github.event.inputs.commit_sha == '' }}" | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/checkout@v4 | |
| if: "${{ github.event.inputs.commit_sha != '' }}" | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ steps.version.outputs.version }} | |
| - name: get Version | |
| id: version | |
| uses: ./.github/actions/version | |
| - name: Download artifact | |
| id: download-artifact | |
| uses: dawidd6/action-download-artifact@v8 | |
| with: | |
| workflow: build.yml | |
| workflow_conclusion: success | |
| branch: master | |
| event: push | |
| if_no_artifact_found: fail | |
| allow_forks: false | |
| - name: output_dir | |
| run: ls -al artifact-*/ | |
| - id: extract-changelog | |
| uses: sean0x42/markdown-extract@v2.1.0 | |
| with: | |
| file: CHANGELOG.md | |
| pattern: ${{ steps.version.outputs.version }} | |
| - name: Release | |
| id: release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: artifact-*/*.apk | |
| draft: false | |
| tag_name: ${{ steps.version.outputs.version }} | |
| fail_on_unmatched_files: true | |
| generate_release_notes: true | |
| body: ${{ steps.extract-changelog.outputs.markdown }} | |
| update_json: | |
| permissions: | |
| contents: write | |
| name: Update JSON | |
| runs-on: ubuntu-latest | |
| needs: prepare_release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: get values | |
| id: get-fields | |
| env: | |
| version: ${{needs.prepare_release.outputs.version}} | |
| url: ${{fromJSON(needs.prepare_release.outputs.assets)[ 0 ].browser_download_url}} | |
| changelog: ${{needs.prepare_release.outputs.changelog}} | |
| run: | | |
| readarray -d "." -t versionSplit <<< "$version" | |
| echo $versionSplit | |
| for i in "${!versionSplit[@]}"; do | |
| versionSplit[i]=`echo "$versionSplit[i]" | egrep -o '[0-9.]+'` | |
| done | |
| config="{\"appVersion.version.major': '${versionSplit[0]}', 'appVersion.version.minor': '${versionSplit[1]}', 'appVersion.version.patch': '${versionSplit[2]}', 'appVersion.url': '$url', 'appVersion.changelog': '$changelog'}" | |
| echo $config | |
| echo "config<<EOF" >> $GITHUB_OUTPUT | |
| echo "$config" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Update Dynamic Config | |
| uses: restackio/update-json-file-action@2.1 | |
| with: | |
| # file name/path to edit. e.g 'package.json' | |
| file: assets/dynamic_config.json | |
| # fields to edit. can be nested fields. example: {'a.b.c[0]': 'value_here', 'z.x': 'value_here'} | |
| fields: ${{ steps.get-fields.outputs.config }} | |
| - name: Stage Changes | |
| run: git config user.email "github-actions[bot]@users.noreply.github.com" && git config user.name "github-actions[bot]" && git commit -am "Update Dynamic Config latest app version" | |
| - name: Push changes | |
| uses: ad-m/github-push-action@master |