-
Notifications
You must be signed in to change notification settings - Fork 20
54 lines (43 loc) · 1.38 KB
/
Copy pathpush_gem.yml
File metadata and controls
54 lines (43 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Publish gem to rubygems.org
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
push:
if: github.repository == 'shugo/textbringer'
runs-on: ubuntu-latest
environment:
name: rubygems.org
url: https://rubygems.org/gems/textbringer
permissions:
contents: write
id-token: write
steps:
# Set up
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@v7
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ruby
# Release
- name: Publish to RubyGems
uses: rubygems/release-gem@v1
- name: Create GitHub release
run: |
tag_name="$(git describe --tags --abbrev=0)"
gh release create "${tag_name}" --verify-tag --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Purge GitHub cache
shell: bash
run: |
urls=$(curl -sL "https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/tree/main" | grep -Eo "(http|https)://camo.githubusercontent.com[a-zA-Z0-9./?=_%:-]*")
while IFS= read -r url; do echo -e "\nPurge $url"; curl -X PURGE "$url"; done <<< "$urls"