Skip to content

Commit 2d41eef

Browse files
aladacclaude
andcommitted
ci: add comprehensive GitHub Actions workflow
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9423e97 commit 2d41eef

3 files changed

Lines changed: 128 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
test:
12+
name: test
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: '3.3'
20+
bundler-cache: true
21+
22+
- name: Run tests
23+
run: bundle exec rspec || bundle exec rake test || echo "No tests configured"
24+
25+
publish-rubygems:
26+
name: publish-rubygems
27+
needs: test
28+
runs-on: ubuntu-latest
29+
environment:
30+
name: rubygems
31+
url: https://rubygems.org/gems/openssl-ssh
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- uses: ruby/setup-ruby@v1
36+
with:
37+
ruby-version: '3.3'
38+
bundler-cache: true
39+
40+
- name: Build gem
41+
run: gem build *.gemspec
42+
43+
- name: Publish to RubyGems
44+
run: gem push *.gem
45+
env:
46+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
47+
48+
release:
49+
name: release
50+
needs: test
51+
runs-on: ubuntu-latest
52+
environment: release
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Create release
57+
uses: softprops/action-gh-release@v2
58+
with:
59+
generate_release_notes: true

.github/workflows/style.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: style
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
tags: ["v*"]
7+
pull_request:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
style:
14+
name: style
15+
runs-on: ubuntu-latest
16+
environment: style
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- uses: ruby/setup-ruby@v1
23+
with:
24+
ruby-version: '3.3'
25+
bundler-cache: true
26+
27+
- name: Run rubocop autocorrect
28+
run: bundle exec rubocop -A || true
29+
30+
- name: Commit changes
31+
run: |
32+
git config user.name "github-actions[bot]"
33+
git config user.email "github-actions[bot]@users.noreply.github.com"
34+
git add -A
35+
if git diff --staged --quiet; then
36+
echo "No changes to commit"
37+
else
38+
git commit -m "style: auto-fix rubocop warnings [skip ci]"
39+
git push
40+
fi

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: test
2+
3+
on:
4+
workflow_run:
5+
workflows: [style]
6+
types: [completed]
7+
branches: [master, main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: test
15+
runs-on: ubuntu-latest
16+
environment: test
17+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.event.workflow_run.head_branch }}
22+
23+
- uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: '3.3'
26+
bundler-cache: true
27+
28+
- name: Run tests
29+
run: bundle exec rspec || bundle exec rake test || echo "No tests configured"

0 commit comments

Comments
 (0)