-
Notifications
You must be signed in to change notification settings - Fork 44
58 lines (51 loc) · 1.67 KB
/
publish.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
name: Publish
on:
release:
types: [created]
jobs:
publish-rubygems:
runs-on: ubuntu-latest
steps:
- name: Setup Ruby, JRuby and TruffleRuby
uses: ruby/[email protected]
with:
ruby-version : 2.7.6
- uses: actions/checkout@v4
- name: Install dependecies
run: bundle install
- name: Run Tests
run: ./run_tests.sh
- name: Determine version from git tag
id: version
run: |
echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: set version
run: |
rm ./lib/approvals/version.rb
echo "module Approvals; VERSION = \"${{ steps.version.outputs.tag }}\"; end" > ./lib/approvals/version.rb
- name: Push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "v${{ steps.version.outputs.tag }}" -a || echo "nothing to commit"
git checkout -b temp
git fetch
git checkout main
git merge temp
remote="https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git"
branch="main"
git push "${remote}" ${branch} || echo "nothing to push"
shell: bash
- name: Generate gem credentials
run: |
mkdir -p ~/.gem
cat << EOF > ~/.gem/credentials
---
:rubygems_api_key: ${{ secrets.RUBY_GEMS_KEY }}
EOF
- name: Chmod file
run: chmod 0600 ~/.gem/credentials
- name: Publish
run: |
git status
bundle exec rake release --trace