chore: bump to 2.10.5+21005002 #145
Workflow file for this run
This file contains 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
name: Add Artifacts for Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Draft a release in specific tag, e.g. v1.0.0" | |
required: false | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" # Release only | |
jobs: | |
check-version: | |
name: Check pubspec.yaml version with tag | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.tag.outputs.result }} | |
build_code: ${{ steps.pubspec_version.outputs.code }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract pubspec version and code | |
id: pubspec_version | |
run: | | |
ver=$(grep -m 1 '^version: ' pubspec.yaml | cut -d' ' -f2) | |
echo "version=$(echo "$ver" | cut -f1 -d"+")" >> $GITHUB_OUTPUT | |
echo "code=$(echo "$ver" | cut -f2- -d"+")" >> $GITHUB_OUTPUT | |
- name: Get tag that trigger this workflow | |
id: tag | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
return context.eventName === 'workflow_dispatch' | |
? '${{ github.event.inputs.tag }}' | |
: context.payload.ref.replace(/\/?refs\/tags\//, ''); | |
- name: Check version | |
run: test '${{ steps.tag.outputs.result }}' = 'v${{ steps.pubspec_version.outputs.version }}' | |
# If pushing released tag (vX.X.X), it should be fired. | |
# Should build some artifacts, see below. | |
get-release: | |
name: Get release | |
runs-on: ubuntu-latest | |
needs: check-version | |
outputs: | |
changelog: ${{ steps.get_release.outputs.changelog }} | |
release_id: ${{ steps.get_release.outputs.release_id }} | |
steps: | |
# escape special characters | |
# https://github.com/actions/toolkit/issues/403 | |
- name: Get Changelog from rc1 | |
id: get_release | |
run: | | |
release=$(curl -s \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H 'Accept: application/vnd.github.v3+json' \ | |
https://api.github.com/repos/evan361425/flutter-pos-system/releases \ | |
| jq -c '.[] | select( .name | contains("${{ needs.check-version.outputs.tag }}"))') | |
[ -z "$release" ] && exit 1 | |
{ | |
echo 'changelog<<EOF' | |
echo "$release" | jq -r '.body' | sed 's/^## //' | sed 's/^-/•/' | |
echo EOF | |
} >> "$GITHUB_OUTPUT" | |
echo "release_id=$(echo "$release" | jq -r '.id')" >> "$GITHUB_OUTPUT" | |
# Push changelog to repository | |
add-changelog: | |
name: Add changelog to Fastlane | |
runs-on: ubuntu-latest | |
needs: | |
- get-release | |
- check-version | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: "master" | |
- name: Push to GitHub | |
run: | | |
# Update release tag name for later deploy to playstore | |
curl -X PATCH \ | |
-H 'Accept: application/vnd.github.v3+json' \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-d '{"tag_name":"${{ needs.check-version.outputs.tag }}"}' \ | |
"https://api.github.com/repos/evan361425/flutter-pos-system/releases/${{ needs.get-release.outputs.release_id }}" |