-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (66 loc) · 2.15 KB
/
freeagent-gem.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
name: Gem Build and Release
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # bundle install
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Setup Poetry # Required for testing but not for building the gem.
uses: abatilo/actions-poetry@v2.4.0
with:
poetry-version: "1.1.13"
- run: bundle install
- run: bundle exec rake test
release:
name: Gem / Release
needs: test # Only release IF the tests pass
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release-gem.outputs.pushed-version }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: fac/ruby-gem-setup-credentials-action@v2
with:
token: ${{ secrets.github_token }}
- name: Build Gem
run: bundle exec rake build
# Release production gem version from default branch
- name: Release Gem
id: release-gem
if: ${{ github.ref == 'refs/heads/main' }}
uses: fac/ruby-gem-push-action@v2
with:
key: github
# PR branch builds will release pre-release gems
- name: Pre-Release Gem
if: ${{ github.ref != 'refs/heads/main' }}
uses: fac/ruby-gem-push-action@v2
with:
key: github
pre-release: true
# Trigger the "Push to Github Container Registry" workflow manually,
# since events triggered by the GITHUB_TOKEN don’t trigger other workflows:
# https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
trigger-ghcr-push:
name: Trigger container push to GHCR
runs-on: ubuntu-latest
needs: release
if: ${{needs.release.outputs.version}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- run: gh workflow --repo ${{ github.repository }} run "Push to Github Container Registry" -f version=${{needs.release.outputs.version}}