Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 1 | name: release |
| 2 | on: |
| 3 | push: |
| 4 | branches: |
godofredoc | 99cae89 | 2021-12-13 13:53:17 -0800 | [diff] [blame] | 5 | - main |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 6 | |
godofredoc | cc10f00 | 2022-02-16 19:14:21 -0800 | [diff] [blame] | 7 | # Declare default permissions as read only. |
| 8 | permissions: read-all |
| 9 | |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 10 | jobs: |
| 11 | release: |
| 12 | if: github.repository_owner == 'flutter' |
| 13 | name: release |
David Iglesias | 064afdd | 2021-09-14 19:22:38 -0700 | [diff] [blame] | 14 | permissions: |
| 15 | # Release needs to push a tag back to the repo. |
| 16 | contents: write |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 17 | runs-on: ubuntu-latest |
| 18 | steps: |
| 19 | - name: "Install Flutter" |
| 20 | # Github Actions don't support templates so it is hard to share this snippet with another action |
| 21 | # If we eventually need to use this in more workflow, we could create a shell script that contains this |
| 22 | # snippet. |
stuartmorgan | 5a2337f | 2023-05-11 13:38:23 -0700 | [diff] [blame] | 23 | # |
| 24 | # This uses a pinned version of Flutter rather than `stable` so that it is |
| 25 | # not subject to out-of-band failures when new releases happen. It does |
| 26 | # not use the auto-rolled pin because there's no way for the autoroller |
| 27 | # to test the actual release flow, so changes would still show up in |
| 28 | # post-submit. A manually-rolled pin means that any changes here must be |
| 29 | # made deliberately, so that the person updating it knows to watch the |
| 30 | # next actual auto-release to ensure that it works, and knows to revert |
| 31 | # the change if it doesn't. |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 32 | run: | |
| 33 | cd $HOME |
stuartmorgan | 5a2337f | 2023-05-11 13:38:23 -0700 | [diff] [blame] | 34 | git clone https://github.com/flutter/flutter.git --depth 1 -b 3.10.0 _flutter |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 35 | echo "$HOME/_flutter/bin" >> $GITHUB_PATH |
| 36 | cd $GITHUB_WORKSPACE |
| 37 | # Checks out a copy of the repo. |
| 38 | - name: Check out code |
dependabot[bot] | b24b8c2 | 2023-04-15 04:45:21 +0000 | [diff] [blame] | 39 | uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 40 | with: |
| 41 | fetch-depth: 0 # Fetch all history so the tool can get all the tags to determine version. |
| 42 | - name: Set up tools |
Stuart Morgan | 6db4a95 | 2023-02-13 12:01:14 -0500 | [diff] [blame] | 43 | run: dart pub get |
| 44 | working-directory: ${{ github.workspace }}/script/tool |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 45 | |
Stuart Morgan | 6db4a95 | 2023-02-13 12:01:14 -0500 | [diff] [blame] | 46 | # This workflow should be the last to run. So wait for all the other tests to succeed. |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 47 | - name: Wait on all tests |
dependabot[bot] | 3a8103e | 2023-02-27 21:58:09 +0000 | [diff] [blame] | 48 | uses: lewagon/wait-on-check-action@e106e5c43e8ca1edea6383a39a01c5ca495fd812 |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 49 | with: |
| 50 | ref: ${{ github.sha }} |
| 51 | running-workflow-name: 'release' |
| 52 | repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 53 | wait-interval: 180 # seconds |
David Iglesias | 77eac14 | 2021-09-08 13:48:53 -0700 | [diff] [blame] | 54 | allowed-conclusions: success,neutral |
Stuart Morgan | 6db4a95 | 2023-02-13 12:01:14 -0500 | [diff] [blame] | 55 | # verbose:true will produce too many logs that hang github actions web UI. |
| 56 | verbose: false |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 57 | |
| 58 | - name: run release |
| 59 | run: | |
| 60 | git config --global user.name ${{ secrets.USER_NAME }} |
| 61 | git config --global user.email ${{ secrets.USER_EMAIL }} |
Stuart Morgan | 6db4a95 | 2023-02-13 12:01:14 -0500 | [diff] [blame] | 62 | dart ./script/tool/lib/src/main.dart publish --all-changed --base-sha=HEAD~ --skip-confirmation --remote=origin |
Chris Yang | 48f5ae2 | 2021-06-30 16:26:04 -0700 | [diff] [blame] | 63 | env: {PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"} |