-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (72 loc) · 2.31 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Publish the gem to RubyGems
on:
push:
branches:
- main
concurrency:
group: publish
jobs:
test:
uses: ./.github/workflows/test.yml
check_for_release:
needs: [test]
runs-on: ubuntu-latest
outputs:
ruby: ${{ steps.package_version.outputs.ruby }}
ruby_semver: ${{ steps.package_version.outputs.ruby_semver }}
exists: ${{ steps.version_tag.outputs.exists }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Get package version
id: package_version
run: |
echo "ruby=$(./bin/version)" >> $GITHUB_OUTPUT
echo "ruby_semver=$(./bin/semver)" >> $GITHUB_OUTPUT
- name: Check if version tag already exists
id: version_tag
uses: mukunku/tag-exists-action@bdad1eaa119ce71b150b952c97351c75025c06a9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: v${{ steps.package_version.outputs.ruby }}
publish:
if: ${{ needs.check_for_release.outputs.exists == 'false' }}
runs-on: ubuntu-latest
needs: [check_for_release]
permissions:
id-token: write
contents: write
environment: ruby-gems
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Publish packaged to RubyGems
uses: rubygems/release-gem@v1
release:
if: ${{ needs.check_for_release.outputs.exists == 'false' }}
runs-on: ubuntu-latest
needs: [publish, check_for_release]
permissions:
id-token: write
contents: write
environment: ruby-gems
steps:
- uses: actions/checkout@v4
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
validation_level: warn
version: ${{ needs.check_for_release.outputs.ruby_semver }}
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.check_for_release.outputs.ruby }}
name: CCS Frontend Helpers v${{ needs.check_for_release.outputs.ruby }}
prerelease: ${{ contains(needs.check_for_release.outputs.ruby, 'beta') }}
body: ${{ steps.changelog_reader.outputs.changes }}