From 12f69f40f59a3c98c9a4795bcc0ef9007dd7f729 Mon Sep 17 00:00:00 2001 From: Jason Garber Date: Tue, 30 Jan 2024 15:10:19 -0500 Subject: [PATCH] Add Release GitHub Actions workflow This commit adds a GitHub Actions workflow that will build and publish a new version of the gem to RubyGems. The workflow follows the pattern described in RubyGems' "Trusted Publishing" documentation [1]. The workflow is triggered whenever a new Release is published by anyone with permissions to do so on the project's GitHub repository. This should work for pre-release versions, as well. Releases may be created via the website [2] or by using the GitHub CLI: ```sh gh release create v0.1.0 --generate-notes ``` Being sure to swap out `v0.1.0` with an appropriate (new or existing) tag, of course. Note that draft releases and/or editing existing releases will not re-trigger this workflow. This commit follows up on my question/comment [3] on #3. [1] https://guides.rubygems.org/trusted-publishing/releasing-gems/ [2] https://github.com/github-community-projects/graphql-client/releases [3] https://github.com/github-community-projects/graphql-client/pull/3#issuecomment-1910521991 --- .github/workflows/release.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ff94506 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +name: Release + +on: + release: + types: [published] + +jobs: + release: + name: Release to RubyGems + permissions: + contents: write + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/checout@v4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: ruby + - uses: rubygems/release-gem@v1