Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
171 lines (169 loc) · 6.13 KB
/
Copy pathaction.yml
File metadata and controls
171 lines (169 loc) · 6.13 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Ruby Gem Release
description: Validate and publish a Ruby gem with Trusted Publishing, then prepare its next development iteration.
author: dblock
branding:
icon: package
color: red
inputs:
version:
description: Optional release version overriding the checked-in version in the standard workflow.
default: ''
gemspec:
description: Optional gemspec path; defaults to the only root gemspec.
default: ''
rubygems-owner:
description: Optional RubyGems account ID for first publication with a pending trusted publisher.
default: ''
git-user-name:
description: Author name for release and next development iteration commits.
default: github-actions[bot]
git-user-email:
description: Author email for release and next development iteration commits.
default: github-actions[bot]@users.noreply.github.com
ruby-version:
description: Ruby version used to validate and build.
required: true
timezone:
description: Timezone for release dates and Git timestamps.
default: UTC
validate:
description: Command validating release preconditions; must exit nonzero on failure.
default: bundle exec rake release:validate
prepare:
description: Command to prepare release files; INPUT_VERSION is the selected release version.
default: bundle exec rake release:prepare
test:
description: Command to test the prepared release.
default: bundle exec rake
publish:
description: Idempotent publication command; runs after recovery artifacts are preserved.
default: bundle exec rake release:publish
bump:
description: Command to prepare, commit, and push the next development iteration.
default: bundle exec rake release:bump
success:
description: Command to run after the release and next development iteration succeed.
default: bundle exec rake release:success
failure:
description: Command to run after a release job failure.
default: bundle exec rake release:failure
runs:
using: composite
steps:
- uses: actions/checkout@v7
id: checkout
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
id: setup_ruby
with:
ruby-version: ${{ inputs.ruby-version }}
bundler-cache: true
- name: Configure Release Inputs
id: configure_release_inputs
shell: bash
env:
RELEASE_STEP_ID: configure_release_inputs
INPUT_VERSION: ${{ inputs.version }}
INPUT_GEMSPEC_PATH: ${{ inputs.gemspec }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
GIT_USER_NAME: ${{ inputs.git-user-name }}
GIT_USER_EMAIL: ${{ inputs.git-user-email }}
RUBYGEMS_OWNER_ID: ${{ inputs.rubygems-owner }}
TZ: ${{ inputs.timezone }}
run: bundle exec rake release:workflow:configure
- name: Capture Release Context
id: capture_release_context
shell: bash
env:
RELEASE_STEP_ID: capture_release_context
run: bundle exec rake release:workflow:capture
- name: Validate Release
id: validate_release
shell: bash
env:
RELEASE_COMMAND: ${{ inputs.validate }}
RELEASE_STEP_ID: validate_release
RELEASE_STEPS_JSON: ${{ toJSON(steps) }}
run: bash -euo pipefail -c "$RELEASE_COMMAND"
- name: Prepare Release
id: prepare_release
shell: bash
env:
RELEASE_COMMAND: ${{ inputs.prepare }}
RELEASE_STEP_ID: prepare_release
RELEASE_STEPS_JSON: ${{ toJSON(steps) }}
run: bash -euo pipefail -c "$RELEASE_COMMAND"
- name: Resolve Prepared Version
id: resolve_prepared_version
shell: bash
env:
RELEASE_STEP_ID: resolve_prepared_version
run: bundle exec rake release:workflow:resolve
- name: Test Release
id: test_release
shell: bash
env:
RELEASE_COMMAND: ${{ inputs.test }}
RELEASE_STEP_ID: test_release
RELEASE_STEPS_JSON: ${{ toJSON(steps) }}
run: bash -euo pipefail -c "$RELEASE_COMMAND"
- name: Checkpoint Release
id: checkpoint_release
shell: bash
env:
RELEASE_STEP_ID: checkpoint_release
run: bundle exec rake release:workflow:checkpoint
- name: Preserve Release Artifacts
id: preserve_release_artifacts
uses: actions/upload-artifact@v7
with:
name: release-gem-${{ env.RELEASE_VERSION }}-${{ github.run_id }}-${{ github.run_attempt }}
path: |
${{ runner.temp }}/release.gem
${{ runner.temp }}/release.json
${{ runner.temp }}/release.bundle
if-no-files-found: error
retention-days: 30
- name: Publish Release
id: publish_release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
RELEASE_COMMAND: ${{ inputs.publish }}
RELEASE_STEP_ID: publish_release
RELEASE_STEPS_JSON: ${{ toJSON(steps) }}
run: bash -euo pipefail -c "$RELEASE_COMMAND"
- name: Prepare Next Development Iteration
id: prepare_next_development_iteration
shell: bash
env:
RELEASE_COMMAND: ${{ inputs.bump }}
RELEASE_STEP_ID: prepare_next_development_iteration
RELEASE_STEPS_JSON: ${{ toJSON(steps) }}
run: bash -euo pipefail -c "$RELEASE_COMMAND"
- name: Run Release Success Callback
id: release_success_callback
if: ${{ success() }}
shell: bash
env:
RELEASE_COMMAND: ${{ inputs.success }}
RELEASE_STEP_ID: release_success_callback
RELEASE_STEPS_JSON: ${{ toJSON(steps) }}
run: bash -euo pipefail -c "$RELEASE_COMMAND"
- name: Determine Release Failure Phase
id: determine_release_failure_phase
if: ${{ failure() && steps.setup_ruby.outcome == 'success' }}
shell: bash
env:
RELEASE_STEPS_JSON: ${{ toJSON(steps) }}
run: bundle exec rake release:workflow:failure_phase
- name: Run Release Failure Callback
id: release_failure_callback
if: ${{ failure() && steps.setup_ruby.outcome == 'success' }}
shell: bash
env:
RELEASE_COMMAND: ${{ inputs.failure }}
RELEASE_STEP_ID: release_failure_callback
RELEASE_STEPS_JSON: ${{ toJSON(steps) }}
run: bash -euo pipefail -c "$RELEASE_COMMAND"