Bump up (on GitHub-hosted) #67
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: 01 Bump up | |
run-name: Bump up ${{ (vars.RUNS_ON_SELF_HOSTED == null && '(on GitHub-hosted)') || '(on self-hosted)' }} | |
on: | |
workflow_dispatch: | |
inputs: | |
bump: | |
type: choice | |
description: Bump Target | |
default: 'build' | |
options: | |
- build | |
- patch | |
- minor | |
- major | |
env: | |
GIT_USER_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com' | |
GIT_USER_NAME: 'github-actions[bot]' | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
bump: | |
runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }} | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }} | |
channel: stable | |
cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }} | |
- run: flutter pub get | |
- name: init git config | |
run: | | |
git config --local user.name $GIT_USER_NAME | |
git config --local user.email $GIT_USER_EMAIL | |
- name: bump up version | |
run: | | |
echo choice: ${{ github.event.inputs.bump }} | |
flutter pub run cider bump ${{ github.event.inputs.bump }} --bump-build | |
echo "BUMP_VERSION=$(flutter pub run cider version)" >> $GITHUB_ENV | |
- id: app-token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ secrets.APPS_APP_ID }} | |
private-key: ${{ secrets.APPS_PRIVATE_KEY }} | |
- name: commit and push pubspec.yaml | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
run: | | |
git add -u pubspec.yaml | |
echo "Bumped version: $BUMP_VERSION" | git commit --file=- | |
git push | |
- name: create tag and release note | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
run: | | |
gh release create v$BUMP_VERSION --target ${{ github.ref_name }} --generate-notes |