-
Notifications
You must be signed in to change notification settings - Fork 14
65 lines (65 loc) · 2.62 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
name: Publish Package to rubygems.org and GitHub Registry
on:
push:
branches:
- "master"
jobs:
release-to-registries:
runs-on: ubuntu-latest
# The release workflow should only be triggered by conventional
# tags. For details, see the Angular contributing documentation at:
# https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format
if: |
startsWith(github.event.head_commit.message, 'build')
|| startsWith(github.event.head_commit.message, 'ci')
|| startsWith(github.event.head_commit.message, 'docs')
|| startsWith(github.event.head_commit.message, 'feat')
|| startsWith(github.event.head_commit.message, 'fix')
|| startsWith(github.event.head_commit.message, 'perf')
|| startsWith(github.event.head_commit.message, 'refactor')
|| startsWith(github.event.head_commit.message, 'test')
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: "14"
- uses: actions/[email protected]
with:
ruby-version: "2.6"
- name: run semantic release
run: |
cp README.md docs/README.md
cp SECURITY.md docs/security.md
cp CODE_OF_CONDUCT.md docs/code.md
npm install && npm run release
env:
GIT_AUTHOR_NAME: tianhaoz95
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: tianhaoz95
GIT_COMMITTER_EMAIL: [email protected]
GITHUB_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
GEM_HOST_API_KEY: ${{ secrets.RUBY_GEMS_TOKEN }}
- name: setup release credentials
env:
RELEASE_TOKEN: ${{ secrets.RUBY_GEMS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
run: |
rm -rf ~/.gem/credentials
mkdir -p ~/.gem
echo "---" > ~/.gem/credentials
echo ":github: Bearer ${GITHUB_TOKEN}" >> ~/.gem/credentials
echo ":rubygems_api_key: ${RELEASE_TOKEN}" >> ~/.gem/credentials
chmod 0600 ~/.gem/credentials
- name: upload to registries
env:
GITHUB_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Tianhao Zhou"
echo "machine github.com login tianhaoz95 password $GITHUB_TOKEN" > ~/.netrc
bundle install
rake install
gem push pkg/*.gem
gem push --key github --host https://rubygems.pkg.github.com/tianhaoz95 pkg/*.gem