зеркало из https://github.com/github/ruby.git
109 строки
4.4 KiB
YAML
109 строки
4.4 KiB
YAML
name: Publish Ruby packages
|
|
|
|
on:
|
|
repository_dispatch:
|
|
types:
|
|
- release
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version of the Ruby package to release'
|
|
required: true
|
|
default: '3.3.4'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: 3.3.4
|
|
|
|
- name: Store Ruby version
|
|
run: |
|
|
echo "RUBY_VERSION=${{ github.event.client_payload.version || github.event.inputs.version }}" >> $GITHUB_ENV
|
|
|
|
- name: Store ABI version
|
|
run: echo "ABI_VERSION=$(echo ${{ env.RUBY_VERSION }} | cut -d '.' -f 1-2)" >> $GITHUB_ENV
|
|
|
|
- name: Copy draft package `/tmp` to `/pub` directory
|
|
run: tool/release.sh ${{ env.RUBY_VERSION }}
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.FTP_R_L_O_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.FTP_R_L_O_AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: us-west-2
|
|
|
|
- name: Purge URLs of release package
|
|
run: |
|
|
curl -X POST \
|
|
-H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \
|
|
https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.tar.gz
|
|
curl -X POST \
|
|
-H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \
|
|
https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.tar.xz
|
|
curl -X POST \
|
|
-H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \
|
|
https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.zip
|
|
|
|
- name: Create a release on GitHub
|
|
run: |
|
|
RELEASE_TAG=$(echo v${{ env.RUBY_VERSION }} | sed 's/\./_/g')
|
|
echo $RELEASE_TAG
|
|
PREVIOUS_RELEASE_TAG=$(echo $RELEASE_TAG | awk 'BEGIN {FS="_"; OFS="_"}{ $NF=$NF-1; print }')
|
|
echo $PREVIOUS_RELEASE_TAG
|
|
tool/gen-github-release.rb $PREVIOUS_RELEASE_TAG $RELEASE_TAG --no-dry-run
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}
|
|
|
|
- name: Update versions index
|
|
run: |
|
|
curl -L -X POST \
|
|
-H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/ruby/actions/dispatches \
|
|
-d '{"event_type": "update_index"}'
|
|
|
|
- name: Set latest flag for Ruby 3.3
|
|
if: contains(${{ env.RUBY_VERSION }}, '3.3.')
|
|
run: |
|
|
echo "LATEST=true" >> $GITHUB_ENV
|
|
|
|
- name: Build and push Docker images
|
|
run: |
|
|
curl -L -X POST \
|
|
-H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/ruby/docker-images/dispatches \
|
|
-d '{"event_type": "build", "client_payload": {"ruby_version": "${{ env.RUBY_VERSION }}", "arch": "amd64", "latest": "${{ env.LATEST }}"}}'
|
|
|
|
- name: Build snapcraft packages
|
|
run: |
|
|
curl -L -X POST \
|
|
-H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/ruby/snap.ruby/dispatches \
|
|
-d '{"event_type": "build", "client_payload": {"ruby_version": "${{ env.RUBY_VERSION }}"}}'
|
|
|
|
- name: Update ruby-build definition
|
|
run: |
|
|
curl -L -X POST \
|
|
-H "Authorization: Bearer ${{ secrets.RUBY_BUILD_WORKFLOW_TOKEN }}" \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/rbenv/ruby-build/dispatches \
|
|
-d '{"event_type": "update-ruby"}'
|
|
|
|
- name: Update all-ruby definition
|
|
run: |
|
|
curl -L -X POST \
|
|
-H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/ruby/all-ruby/dispatches \
|
|
-d '{"event_type": "update"}'
|