-
Notifications
You must be signed in to change notification settings - Fork 5
65 lines (54 loc) · 1.87 KB
/
Copy pathrelease.yml
File metadata and controls
65 lines (54 loc) · 1.87 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
55
56
57
58
59
60
61
62
63
64
65
name: Publish Release
on:
pull_request:
types: [closed]
branches:
- main
jobs:
publish:
# Only run if PR was merged and branch starts with "release/v"
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v')
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.ALCHEMY_BOT_APP_ID }}
private-key: ${{ secrets.ALCHEMY_BOT_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Extract version from branch name
id: version
run: |
VERSION=$(echo "${{ github.event.pull_request.head.ref }}" | sed 's/release\/v//')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
- name: Configure git
run: |
git config user.name "alchemycms-bot"
git config user.email "alchemycms-bot@users.noreply.github.com"
- name: Create and push tag
run: |
git tag "v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"
- name: Build gem
run: gem build alchemy_cloudinary.gemspec
- name: Publish to RubyGems
run: gem push alchemy_cloudinary-*.gem
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
generate_release_notes: true
files: alchemy_cloudinary-*.gem
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}