Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 41 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,52 @@
name: Release
name: Release gem on RubyGems.org and create GitHub release

on:
push:
tags:
- v*
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
publish:
release_gem:
name: Release gem on RubyGems.org
if: github.repository == 'Shopify/tapioca'
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write

environment: release

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
name: Checkout
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Create release
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
- name: Set up Ruby
uses: ruby/setup-ruby@dffb23f65a78bba8db45d387d5ea1bbd6be3ef18 # v1.293.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: "${{ github.ref }}",
name: "${{ github.ref_name }}",
generate_release_notes: true
})
bundler-cache: true

- name: Release gem on RubyGems.org
uses: rubygems/release-gem@e9a6361a0b14562539327c2a02373edc56dd3169 # v1.1.4

release_github:
name: Create GitHub release
if: github.repository == 'Shopify/tapioca'
needs: release_gem
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Create GitHub release
run: |
tag_name="$(git describe --tags --abbrev=0)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, since this action will be triggered with a tag push, I wonder if there is no way to read the tag that triggered the push instead of trying to find it again in the repository.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it is actually what we've been using all along: github.ref or github.ref_name

gh release create "${tag_name}" --verify-tag --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading