From 9dd280094772eb98880b73ad6415fd553e2907a0 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 31 Jul 2024 14:41:04 +0900 Subject: [PATCH] We should run release.sh with release tag --- .github/workflows/publish.yml | 19 ------------------ .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d832792094d243..4bb647de3e3a55 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,16 +8,6 @@ jobs: notify: runs-on: ubuntu-latest steps: - - name: Set latest flag for Ruby 3.3 - if: contains(github.ref, 'v3_3') - run: | - echo "LATEST=true" >> $GITHUB_ENV - - - name: Convert tag name to dot from underscore - run: | - # Convert refs/tags/vX_Y_Z to X.Y.Z - echo "RUBY_VERSION=$(echo ${{ github.ref }} | sed -e 's/refs\/tags\/v//;s/_/./g')" >> $GITHUB_ENV - - name: Build release package run: | curl -L -X POST \ @@ -26,12 +16,3 @@ jobs: -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/ruby/actions/dispatches \ -d '{"event_type": "${{ github.ref }}"}' - - - 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 }}"}}' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000000..dedcad324f8193 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Publish Ruby packages + +on: + repository_dispatch: + types: + - release + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Copy draft package `/tmp` to `/pub` directory + run: tool/release.sh ${{ github.event.client_payload.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 + + # TODO + # - name: Create a release on GitHub + + - name: Set latest flag for Ruby 3.3 + if: contains(${{ github.event.client_payload.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": "${{ github.event.client_payload.version }}", "arch": "amd64", "latest": "${{ env.LATEST }}"}}'