Skip to content

Commit 89b7362

Browse files
author
github-actions
committed
Switch to trusted publishing workflow and run it on version.rb changes
1 parent 0d7ff35 commit 89b7362

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

.github/workflows/publish.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1-
name: Publish Gem
1+
name: Publish to RubyGems.org
22

33
on:
44
push:
5-
tags: v*
5+
branches: main
6+
paths: lib/curly/version.rb
7+
workflow_dispatch:
68

79
jobs:
8-
call-workflow:
9-
uses: zendesk/gw/.github/workflows/ruby-gem-publication.yml@main
10-
secrets:
11-
RUBY_GEMS_API_KEY: ${{ secrets.RUBY_GEMS_API_KEY }}
12-
RUBY_GEMS_TOTP_DEVICE: ${{ secrets.RUBY_GEMS_TOTP_DEVICE }}
10+
publish:
11+
runs-on: ubuntu-latest
12+
environment: rubygems-publish
13+
if: github.repository_owner == 'zendesk'
14+
permissions:
15+
id-token: write
16+
contents: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
bundler-cache: false
23+
ruby-version: "3.4"
24+
- name: Install dependencies
25+
run: bundle install
26+
- uses: rubygems/release-gem@v1

CONTRIBUTING.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,22 @@ In order to keep the Curly code base nice and tidy, please observe these best pr
1010
> In order to avoid nasty errors when doing stuff, make the Curly compiler
1111
> fail early when an invalid reference is encountered.
1212
13-
1413
Before making a contribution, you should make sure to understand what Curly is and isn't:
1514

1615
- The template language will never be super advanced: one of the primary use cases for Curly is to allow end users to mess around with Curly templates and have them safely compiled and rendered on a server. As such, the template language will always be as simple as possible.
1716
- The template language is declarative, and is going to stay that way.
17+
18+
### Releasing a new version
19+
A new version is published to RubyGems.org every time a change to `version.rb` is pushed to the `main` branch.
20+
In short, follow these steps:
21+
1. Update `version.rb`,
22+
2. update version in all `Gemfile.lock` files,
23+
3. merge this change into `main`, and
24+
4. look at [the action](https://github.com/zendesk/curly/actions/workflows/publish.yml) for output.
25+
26+
To create a pre-release from a non-main branch:
27+
1. change the version in `version.rb` to something like `1.2.0.pre.1` or `2.0.0.beta.2`,
28+
2. push this change to your branch,
29+
3. go to [Actions → “Publish to RubyGems.org” on GitHub](https://github.com/zendesk/curly/actions/workflows/publish.yml),
30+
4. click the “Run workflow” button,
31+
5. pick your branch from a dropdown.

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'bundler/setup'
12
require 'bundler/gem_tasks'
23
require 'rspec/core/rake_task'
34

0 commit comments

Comments
 (0)