-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (55 loc) · 1.52 KB
/
release.yml
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
55
56
57
name: Release Gem
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
permissions:
contents: write
on:
workflow_dispatch:
inputs:
tag_name:
required: true
type: string
otp:
required: true
type: string
release:
description: "Whether to create a GitHub Release"
type: boolean
default: true
jobs:
release:
name: "Release Gem (Ruby ${{ matrix.ruby_version }})"
runs-on: "ubuntu-latest"
strategy:
fail-fast: true
matrix:
ruby_version:
- 2.7
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: "Set up Ruby ${{ matrix.ruby_version }}"
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Build and Publish Gem
env:
TAG_NAME: ${{ inputs.tag_name }}
OTP: ${{ inputs.otp }}
RUBY_GEMS_API_KEY: ${{ secrets.RUBY_GEMS_API_KEY }}
run: |
set +x
mkdir -p ~/.gem
cat << EOF > ~/.gem/credentials
---
:rubygems_api_key: $RUBY_GEMS_API_KEY
EOF
chmod 0600 ~/.gem/credentials
set -x
sed -i "s/0\.0\.0/$TAG_NAME/g" lib/jekyll-github-repos/version.rb
gem build jekyll-github-repos.gemspec
gem push jekyll-github-repos-$TAG_NAME.gem -k rubygems --otp $OTP
git tag $TAG_NAME
git push origin $TAG_NAME