|
| 1 | +name: release-from-branch |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - 'release/*' |
| 6 | + |
| 7 | +# Declare default permissions as read only. |
| 8 | +permissions: read-all |
| 9 | + |
| 10 | +jobs: |
| 11 | + release: |
| 12 | + if: github.repository_owner == 'flutter' |
| 13 | + name: release-from-branch |
| 14 | + permissions: |
| 15 | + # Release needs to push a tag back to the repo. |
| 16 | + contents: write |
| 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. |
| 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. |
| 32 | + run: | |
| 33 | + cd $HOME |
| 34 | + git clone https://github.com/flutter/flutter.git --depth 1 -b 3.35.0 _flutter |
| 35 | + echo "$HOME/_flutter/bin" >> $GITHUB_PATH |
| 36 | + cd $GITHUB_WORKSPACE |
| 37 | + # Checks out a copy of the repo. |
| 38 | + - name: Check out code |
| 39 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 |
| 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 |
| 43 | + run: dart pub get |
| 44 | + working-directory: ${{ github.workspace }}/script/tool |
| 45 | + |
| 46 | + # Give some time for LUCI checks to start becoming populated. |
| 47 | + # Because of latency in Github Webhooks, we need to wait for a while |
| 48 | + # before being able to look at checks scheduled by LUCI. |
| 49 | + - name: Give webhooks a minute |
| 50 | + run: sleep 60s |
| 51 | + shell: bash |
| 52 | + |
| 53 | + # The next step waits for all tests, but when there are issues with the |
| 54 | + # hooks it can take a long time for the tests to even be registered. If |
| 55 | + # "Wait on all tests" runs before that happens, it will pass immediately |
| 56 | + # because there doesn't appear to be anything to wait for. To avoid that, |
| 57 | + # explicitly wait for one LUCI test by name first. |
| 58 | + - name: Wait for test check-in |
| 59 | + uses: lewagon/wait-on-check-action@0dceb95e7c4cad8cc7422aee3885998f5cab9c79 |
| 60 | + with: |
| 61 | + ref: ${{ github.sha }} |
| 62 | + check-name: 'Linux ci_yaml packages roller' |
| 63 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + wait-interval: 30 # seconds |
| 65 | + allowed-conclusions: success,neutral |
| 66 | + # verbose:true will produce too many logs that hang github actions web UI. |
| 67 | + verbose: false |
| 68 | + |
| 69 | + # This workflow should be the last to run. So wait for all the other tests to succeed. |
| 70 | + - name: Wait on all tests |
| 71 | + uses: lewagon/wait-on-check-action@0dceb95e7c4cad8cc7422aee3885998f5cab9c79 |
| 72 | + with: |
| 73 | + ref: ${{ github.sha }} |
| 74 | + running-workflow-name: 'release-from-branch' |
| 75 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + wait-interval: 180 # seconds |
| 77 | + allowed-conclusions: success,neutral |
| 78 | + # verbose:true will produce too many logs that hang github actions web UI. |
| 79 | + verbose: false |
| 80 | + |
| 81 | + - name: run release |
| 82 | + run: | |
| 83 | + git config --global user.name ${{ secrets.USER_NAME }} |
| 84 | + git config --global user.email ${{ secrets.USER_EMAIL }} |
| 85 | + dart ./script/tool/lib/src/main.dart publish --all-changed --batch-release --base-sha=HEAD~ --skip-confirmation --remote=origin |
| 86 | + env: {PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"} |
0 commit comments