|
1 | | -name: Start release workflow |
| 1 | +name: Publish Ruby packages |
| 2 | + |
2 | 3 | on: |
3 | | - push: |
4 | | - tags: |
5 | | - - '*' |
| 4 | + repository_dispatch: |
| 5 | + types: |
| 6 | + - release |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'Version of the Ruby package to release' |
| 11 | + required: true |
| 12 | + default: '3.3.4' |
6 | 13 |
|
7 | 14 | jobs: |
8 | | - notify: |
| 15 | + release: |
9 | 16 | runs-on: ubuntu-latest |
10 | 17 | steps: |
11 | | - - name: Build release package |
| 18 | + |
| 19 | + |
| 20 | + - uses: ruby/setup-ruby@v1 |
| 21 | + with: |
| 22 | + ruby-version: 3.3.4 |
| 23 | + |
| 24 | + - name: Store Ruby version |
| 25 | + run: | |
| 26 | + echo "RUBY_VERSION=${{ github.event.client_payload.version || github.event.inputs.version }}" >> $GITHUB_ENV |
| 27 | +
|
| 28 | + - name: Store ABI version |
| 29 | + run: echo "ABI_VERSION=$(echo ${{ env.RUBY_VERSION }} | cut -d '.' -f 1-2)" >> $GITHUB_ENV |
| 30 | + |
| 31 | + - name: Copy draft package `/tmp` to `/pub` directory |
| 32 | + run: tool/release.sh ${{ env.RUBY_VERSION }} |
| 33 | + env: |
| 34 | + AWS_ACCESS_KEY_ID: ${{ secrets.FTP_R_L_O_AWS_ACCESS_KEY_ID }} |
| 35 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.FTP_R_L_O_AWS_SECRET_ACCESS_KEY }} |
| 36 | + AWS_DEFAULT_REGION: us-west-2 |
| 37 | + |
| 38 | + - name: Purge URLs of release package |
| 39 | + run: | |
| 40 | + curl -X POST \ |
| 41 | + -H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \ |
| 42 | + https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.tar.gz |
| 43 | + curl -X POST \ |
| 44 | + -H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \ |
| 45 | + https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.tar.xz |
| 46 | + curl -X POST \ |
| 47 | + -H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \ |
| 48 | + https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.zip |
| 49 | +
|
| 50 | + - name: Create a release on GitHub |
| 51 | + run: | |
| 52 | + RELEASE_TAG=$(ruby tool/ruby-version.rb tag "${{ env.RUBY_VERSION }}") |
| 53 | + echo $RELEASE_TAG |
| 54 | + PREVIOUS_RELEASE_TAG=$(ruby tool/ruby-version.rb previous-tag "${{ env.RUBY_VERSION }}") |
| 55 | + echo $PREVIOUS_RELEASE_TAG |
| 56 | + tool/gen-github-release.rb $PREVIOUS_RELEASE_TAG $RELEASE_TAG --no-dry-run |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.MATZBOT_AUTO_UPDATE_TOKEN }} |
| 59 | + |
| 60 | + - name: Update versions index |
12 | 61 | run: | |
13 | 62 | curl -L -X POST \ |
14 | 63 | -H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \ |
15 | 64 | -H "Accept: application/vnd.github+json" \ |
16 | 65 | -H "X-GitHub-Api-Version: 2022-11-28" \ |
17 | 66 | https://api.github.com/repos/ruby/actions/dispatches \ |
18 | | - -d '{"event_type": "${{ github.ref }}"}' |
| 67 | + -d '{"event_type": "update_index"}' |
| 68 | +
|
| 69 | + - name: Build and push Docker images |
| 70 | + run: | |
| 71 | + curl -L -X POST \ |
| 72 | + -H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \ |
| 73 | + -H "Accept: application/vnd.github+json" \ |
| 74 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 75 | + https://api.github.com/repos/ruby/docker-images/actions/workflows/build.yml/dispatches \ |
| 76 | + -d '{"ref": "master", "inputs": {"ruby_version": "${{ env.RUBY_VERSION }}"}}' |
| 77 | +
|
| 78 | + - name: Build snapcraft packages |
| 79 | + run: | |
| 80 | + curl -L -X POST \ |
| 81 | + -H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \ |
| 82 | + -H "Accept: application/vnd.github+json" \ |
| 83 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 84 | + https://api.github.com/repos/ruby/snap.ruby/dispatches \ |
| 85 | + -d '{"event_type": "build", "client_payload": {"ruby_version": "${{ env.RUBY_VERSION }}"}}' |
| 86 | +
|
| 87 | + - name: Store the latest LTS version of OpenSSL |
| 88 | + run: | |
| 89 | + echo "OPENSSL_VERSION=`curl -s https://api.github.com/repos/openssl/openssl/releases | jq -r '.[].tag_name | select(startswith("openssl-3.0"))' | sort -Vr | head -n1 | cut -d'-' -f2`" >> $GITHUB_ENV |
| 90 | +
|
| 91 | + - name: Update ruby-build definition |
| 92 | + run: | |
| 93 | + curl -L -X POST \ |
| 94 | + -H "Authorization: Bearer ${{ secrets.RUBY_BUILD_WORKFLOW_TOKEN }}" \ |
| 95 | + -H "Accept: application/vnd.github+json" \ |
| 96 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 97 | + https://api.github.com/repos/rbenv/ruby-build/dispatches \ |
| 98 | + -d '{"event_type": "update-ruby", "client_payload": {"ruby_version": "${{ env.RUBY_VERSION }}", "openssl_version": "${{ env.OPENSSL_VERSION }}"}}' |
| 99 | +
|
| 100 | + - name: Update all-ruby definition |
| 101 | + run: | |
| 102 | + curl -L -X POST \ |
| 103 | + -H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \ |
| 104 | + -H "Accept: application/vnd.github+json" \ |
| 105 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 106 | + https://api.github.com/repos/ruby/all-ruby/dispatches \ |
| 107 | + -d '{"event_type": "update"}' |
0 commit comments