-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (126 loc) · 4.18 KB
/
main.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Ruby
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test:
runs-on: macos-latest
name: Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- '3.1' # EOL: 2025-03-31
- '3.2' # EOL: 2026-03-31
- '3.3' # EOL: 2027-03-31
- '3.4' # EOL: 2028-03-31
# see supported ruby release schedule at https://www.ruby-lang.org/en/downloads/branches/
- 'system'
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make dylib
working-directory: getargv
- name: Install libgetargv
run: sudo make install_dylib
working-directory: getargv
- uses: actions/checkout@v4
with:
path: getargv_ruby
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
if: ${{ matrix.ruby != 'system' }}
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
working-directory: getargv_ruby
- name: Set up Ruby ${{ matrix.ruby }} pt 1
run: |
echo "/usr/bin:$HOME/.bundle/bin:`/usr/bin/gem environment | awk '/USER INSTALLATION DIRECTORY/{print $NF}'`/bin:$PATH" >> $GITHUB_PATH
echo "GEM_HOME=$HOME/.gem" >> $GITHUB_ENV
if: ${{ matrix.ruby == 'system' }}
- name: Set up Ruby ${{ matrix.ruby }} pt 2
run: |
gem install bundler -v '~>2.4.0' --user-install --no-document
bundle install
working-directory: getargv_ruby
if: ${{ matrix.ruby == 'system' }}
- name: Create .ruby-version file
run: ruby -e 'puts RUBY_VERSION' > .ruby-version
working-directory: getargv_ruby
- name: Run the default task
run: bundle exec rake
working-directory: getargv_ruby
release:
runs-on: macos-latest
needs: [test]
permissions:
id-token: write
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make dylib
working-directory: getargv
- name: Install libgetargv
run: sudo make install_dylib
working-directory: getargv
- uses: actions/checkout@v4
# deliberately do NOT trigger workflow on push to main
with:
path: getargv_ruby
token: ${{ github.token }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
working-directory: getargv_ruby
- name: Bundle install (no deployment/frozen)
run: bundle install --path ./vendor/bundle
working-directory: getargv_ruby
- name: Bump version
# tag done by release, commit done with checksum included
run: bundle exec rake bump:patch COMMIT=false TAG=false | tail -1 | xargs -I {} echo "version={}" >> $GITHUB_OUTPUT
id: version
working-directory: getargv_ruby
- name: Run the build tasks
run: bundle exec rake build build:checksum
working-directory: getargv_ruby
- name: Archive Gem
uses: actions/upload-artifact@v4
with:
name: gem
path: getargv_ruby/pkg/*.gem
- name: Commit checksum and version bump
# add and commit separately because `git commit -am` excludes new files =(
run: |
git add -A
git commit -am "commit checksum for ${{steps.version.outputs.version}}"
working-directory: getargv_ruby
- name: Setup auth
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
env:
GEM_HOST_API_KEY: "Bearer ${{github.token}}"
- name: Release Gem to GitHub Packages
run: gem push --key github --host https://rubygems.pkg.github.com/getargv pkg/*.gem
working-directory: getargv_ruby
- name: Configure RubyGems Credentials
uses: rubygems/configure-rubygems-credentials@main
- name: Release Gem to RubyGems
# tags and pushes
run: bundle exec rake release[origin]
working-directory: getargv_ruby