-
-
Notifications
You must be signed in to change notification settings - Fork 21
build: semi-automated release process #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
extern-c
wants to merge
19
commits into
CycloneDX:master
Choose a base branch
from
extern-c:ci-release
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b22ec67
Implement Release workflow
extern-c 90ac387
Implement rubygems_release CI job
extern-c 4f806b7
Bump actions/checkout from v6.0.2 to v7.0.0
extern-c 7ff9329
Bump ruby/setup-ruby GHA from v1.310.0 to v1.314.0
extern-c 2106cb1
Replace github.ref_name with GITHUB_REF_NAME in release job
extern-c 3e9e0ba
Trigger release workflow only on vMAJOR.MINOR.PATCH tags
extern-c e3c2541
Add comment explaining required permissions for GitHub Releases
extern-c 51b50f1
Add comments explaining required permissions for RubyGems Releases
extern-c da61dd3
Add comment with rubygems/release-gem GHA project URL
extern-c 9e50640
Add support for creating GitHub pre-releases
extern-c a7352f6
Drop global permissions to empty set in release workflow
extern-c 98c2176
Lock rubygems_release ci job to Ruby 3.4 for build stability
extern-c 2af378b
Add built gem as GitHub release asset
extern-c e92d1bd
Add changelog entry for release workflow
extern-c 5545c7c
Update release process in CONTRIBUTING.md
extern-c c1b611c
Fix Markdown warning in CONTRIBUTING.md
extern-c cf5e3d9
Remove unnecessary quotes from step name
extern-c 19f650f
Merge branch 'master' into ci-release
jkowalleck 4026906
Fix typo in CONTRIBUTING.md
extern-c File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: ["v*.*.*"] | ||
|
|
||
| # see https://docs.github.com/en/actions/tutorials/authenticate-with-github_token#modifying-the-permissions-for-the-github_token | ||
| permissions: {} | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - name: Checkout Code | ||
| # see https://github.com/actions/checkout | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up Ruby | ||
| # see https://github.com/ruby/setup-ruby | ||
| uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0 | ||
| with: | ||
| ruby-version: '3.3.9' | ||
| bundler-cache: false | ||
| - name: Install Dependencies | ||
| run: bundle install | ||
| - name: Run the default task | ||
| run: bundle exec rake | ||
|
|
||
| rubygems_release: | ||
| name: RubyGems Release | ||
| if: github.repository == 'CycloneDX/cyclonedx-ruby-gem' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| needs: test | ||
| permissions: | ||
| contents: write # Required for `rake release` to perform git synchronization. | ||
| id-token: write # Required for Trusted Publishing authentication. | ||
| environment: release | ||
| steps: | ||
| - name: Checkout Code | ||
| # see https://github.com/actions/checkout | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up Ruby | ||
| # see https://github.com/ruby/setup-ruby | ||
| uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0 | ||
| with: | ||
| ruby-version: '3.4' # Stable environment to package the gem for the supported ruby versions | ||
| bundler-cache: false | ||
| - name: Push gem to RubyGems | ||
| # see https://github.com/rubygems/release-gem | ||
| uses: rubygems/release-gem@6317d8d1f7e28c24d28f6eff169ea854948bd9f7 # v1.2.0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add a comment with the action's URL for easier docks lookup when maintaining.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in da61dd3. Thanks for the suggestion. |
||
| - name: Upload gem artifact | ||
| # see https://github.com/actions/upload-artifact | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1 | ||
| with: | ||
| name: gem | ||
| path: pkg/*.gem | ||
| retention-days: 1 | ||
|
|
||
| github_release: | ||
| name: GitHub Release | ||
| if: github.repository == 'CycloneDX/cyclonedx-ruby-gem' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| needs: rubygems_release | ||
| environment: release | ||
| # Needed for `gh release create` because GitHub Releases require write access | ||
| # to repository contents, which is not granted by default with GITHUB_TOKEN. | ||
| permissions: | ||
| contents: write | ||
|
jkowalleck marked this conversation as resolved.
|
||
| steps: | ||
| - name: Checkout Code | ||
| # see https://github.com/actions/checkout | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Download gem artifact | ||
| # see https://github.com/actions/download-artifact | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: gem | ||
| path: pkg | ||
| - name: Create GitHub Release | ||
|
jkowalleck marked this conversation as resolved.
|
||
| run: | | ||
|
jkowalleck marked this conversation as resolved.
|
||
| declare -a FLAGS=("--verify-tag" "--generate-notes") | ||
|
|
||
| # Determine release type from tag suffix | ||
| if [[ "$GITHUB_REF_NAME" =~ -(alpha|beta|rc|pre)[0-9.]*$ ]]; then | ||
| FLAGS+=("--prerelease") | ||
| fi | ||
|
|
||
| # Publish the release on GitHub with auto-generated release notes | ||
| gh release create "${FLAGS[@]}" -- "$GITHUB_REF_NAME" pkg/*.gem | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.