|
| 1 | +name: bump version / flutter app |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + date_override: |
| 7 | + description: > |
| 8 | + Optional date to use instead of "now" (recommended format: YYYY-MM-DD). |
| 9 | + required: false |
| 10 | + type: string |
| 11 | + default: "" |
| 12 | + format: |
| 13 | + description: > |
| 14 | + Optional CalVer format string passed directly to bump-calver (blank = default). |
| 15 | + required: false |
| 16 | + type: string |
| 17 | + default: "" |
| 18 | + secrets: |
| 19 | + APP_ID: |
| 20 | + description: GitHub App installation ID |
| 21 | + required: true |
| 22 | + APP_PRIVATE_KEY: |
| 23 | + description: GitHub App private key |
| 24 | + required: true |
| 25 | + |
| 26 | +jobs: |
| 27 | + prepare_next_release: |
| 28 | + name: prepare next release |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - id: generate_token |
| 32 | + name: Generate a GitHub App token |
| 33 | + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a |
| 34 | + with: |
| 35 | + app_id: ${{ secrets.APP_ID }} |
| 36 | + private_key: ${{ secrets.APP_PRIVATE_KEY }} |
| 37 | + |
| 38 | + - name: Checkout source code |
| 39 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 |
| 40 | + with: |
| 41 | + token: ${{ steps.generate_token.outputs.token }} |
| 42 | + ref: main |
| 43 | + fetch-depth: 0 |
| 44 | + |
| 45 | + - name: Add Toolbox Envy to PATH |
| 46 | + uses: EarthmanMuons/toolbox-envy/.github/actions/add-to-path@main |
| 47 | + with: |
| 48 | + include_bins: | |
| 49 | + common |
| 50 | + flutter |
| 51 | +
|
| 52 | + - name: Configure Git identity |
| 53 | + run: | |
| 54 | + git config user.name "senile-errata[bot]" |
| 55 | + git config user.email "senile-errata@users.noreply.github.com" |
| 56 | +
|
| 57 | + - name: Set up Flutter |
| 58 | + uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e |
| 59 | + with: |
| 60 | + channel: stable |
| 61 | + flutter-version-file: pubspec.yaml |
| 62 | + cache: true |
| 63 | + |
| 64 | + - name: Install dependencies |
| 65 | + run: flutter pub get --enforce-lockfile |
| 66 | + |
| 67 | + - name: Update dependencies |
| 68 | + run: flutter pub upgrade --unlock-transitive |
| 69 | + |
| 70 | + - name: Bump CalVer version for project |
| 71 | + run: | |
| 72 | + bump-calver --format "${{ inputs.format }}" "${{ inputs.date_override }}" | set-project-version |
| 73 | +
|
| 74 | + - name: Bump CHANGELOG version to match |
| 75 | + run: get-project-version | bump-changelog-version |
| 76 | + |
| 77 | + - id: version |
| 78 | + name: Get the new release version |
| 79 | + run: | |
| 80 | + echo "release_version=$(get-project-version)" >>"$GITHUB_OUTPUT" |
| 81 | +
|
| 82 | + - name: Verify changes exist |
| 83 | + run: | |
| 84 | + git update-index -q --really-refresh |
| 85 | + if git diff-index --quiet HEAD --; then |
| 86 | + echo "No changes detected; refusing to open PR." |
| 87 | + exit 1 |
| 88 | + fi |
| 89 | +
|
| 90 | + - id: cpr |
| 91 | + name: Create pull request |
| 92 | + uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 |
| 93 | + with: |
| 94 | + token: ${{ steps.generate_token.outputs.token }} |
| 95 | + branch: release/bump-version |
| 96 | + branch-suffix: timestamp |
| 97 | + commit-message: Release v${{ steps.version.outputs.release_version }} |
| 98 | + title: Prepare v${{ steps.version.outputs.release_version }} release. |
| 99 | + body: |- |
| 100 | + This PR was automatically created by the [bump-version](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) workflow, which ran the following commands: |
| 101 | +
|
| 102 | +
|
| 103 | + ``` |
| 104 | + $ flutter pub upgrade --unlock-transitive |
| 105 | + $ bump-calver --format "${{ inputs.format }}" "${{ inputs.date_override }}" | set-project-version |
| 106 | + $ get-project-version | bump-changelog-version |
| 107 | + ``` |
| 108 | +
|
| 109 | + **Please review the submitted changes.** |
| 110 | +
|
| 111 | + Once this PR is merged into the _main_ branch, an automated process will tag the commit and create a draft GitHub Release with signed assets attached for final review before publishing. |
| 112 | +
|
| 113 | + - name: Annotate workflow run with PR URL |
| 114 | + run: | |
| 115 | + set -euo pipefail |
| 116 | + { |
| 117 | + echo "### Opened pull request for release v${{ steps.version.outputs.release_version }}" |
| 118 | + echo |
| 119 | + echo "- ${{ steps.cpr.outputs.pull-request-url }}" |
| 120 | + } >>"$GITHUB_STEP_SUMMARY" |
0 commit comments