-
Notifications
You must be signed in to change notification settings - Fork 128
75 lines (66 loc) · 2.62 KB
/
publish.yml
File metadata and controls
75 lines (66 loc) · 2.62 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
66
67
68
69
70
71
72
73
74
75
name: Publish package to the RubyGems.org
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'The version to release. v prefix is required (e.g. v1.10.0)'
required: true
jobs:
release-package:
name: Push gem to RubyGems.org
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
issues: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ruby/setup-ruby@6ca151fd1bfcfd6fe0c4eb6837eb0584d0134a0c # v1.290.0
with:
bundler-cache: true
ruby-version: '4.0'
- name: Update version file with the release version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION=${{ github.event.inputs.version }}
else
VERSION=${{ github.event.release.tag_name }}
fi
VERSION=${VERSION#v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
sed -i "s/VERSION = \".*\"/VERSION = \"$VERSION\"/" lib/line/bot/version.rb
sed -i "s/line-bot-api (.*)/line-bot-api ($VERSION)/" Gemfile.lock
cat lib/line/bot/version.rb
# commit
git config user.name github-actions
git config user.email github-actions@github.com
git add lib/line/bot/version.rb Gemfile.lock
git commit -m "Set version to $VERSION"
- uses: rubygems/release-gem@1c162a739e8b4cb21a676e97b087e8268d8fc40b # v1.1.2
- name: Create GitHub Issue on Failure
if: failure()
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const { owner, repo } = context.repo;
const version = process.env.VERSION;
const issueTitle = `Release job for ${version} failed`;
const issueBody = `The release job failed. Please check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.`;
const assignees = [context.actor];
await github.rest.issues.create({
owner,
repo,
title: issueTitle,
body: issueBody,
assignees
});
deploy-docs:
needs: [release-package]
permissions:
contents: read
pages: write
issues: write
id-token: write
uses: ./.github/workflows/deploy-doc.yml