-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (42 loc) · 1.45 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
name: Release and Deploy
on:
push:
branches: [ "master" ]
paths:
- lib/dragnet/version.rb
jobs:
build:
name: Build & Deploy
runs-on: ubuntu-latest
permissions:
contents: write # Needed to create the tag and the release
id-token: write # Needed to push to rubygems.org as a trusted publisher
environment: release
steps:
- uses: actions/checkout@v4
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
with:
ruby-version: 2.7.7
- name: Build
run: |
bundler install
rake clobber
rake build
- name: Get Version
run: |
echo "GEM_VERSION=$(bundler exec ruby -e 'require "dragnet/version"; print Dragnet::VERSION')" | tee -a $GITHUB_ENV
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Github Actions
TAG_NAME: ${{ env.GEM_VERSION }}
NOTES: "[Changelog](${{ github.server_url }}/${{ github.repository }}/blob/${{ env.GEM_VERSION }}/CHANGELOG.md)"
TITLE: Release ${{ env.GEM_VERSION }}
TARGET: ${{ github.ref_name }}
run: |
gh release create $TAG_NAME --notes "$NOTES" --title "$TITLE" --target $TARGET pkg/dragnet-*.gem
- name: Configure trusted publishing credentials
uses: rubygems/configure-rubygems-credentials@v1.0.0
- name: Deploy
run: |
gem push pkg/dragnet-*.gem