From b22ec67e7507733bcfc90e47b27a65bf89d8564f Mon Sep 17 00:00:00 2001 From: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> Date: Thu, 4 Jun 2026 03:49:49 +0000 Subject: [PATCH 01/10] Implement Release workflow Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> --- .github/workflows/release.yml | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9353854 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +name: Release + +on: + push: + tags: ["v*"] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout Code + # see https://github.com/actions/checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Set up Ruby + # see https://github.com/ruby/setup-ruby + uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.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 + runs-on: ubuntu-latest + needs: test + steps: + - run: echo "RubyGems publish (dummy step)" + + github_release: + name: GitHub Release + if: github.repository == 'CycloneDX/cyclonedx-ruby-gem' + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: rubygems_release + environment: release + permissions: + contents: write + steps: + - name: Checkout Code + # see https://github.com/actions/checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Create GitHub Release + run: | + gh release create "${{ github.ref_name }}" \ + --verify-tag \ + --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 90ac3876598a533e51460e89df761db9bf666286 Mon Sep 17 00:00:00 2001 From: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> Date: Sun, 7 Jun 2026 20:01:21 +0000 Subject: [PATCH 02/10] Implement rubygems_release CI job Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> --- .github/workflows/release.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9353854..26af4c5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,10 +30,28 @@ jobs: rubygems_release: name: RubyGems Release + if: github.repository == 'CycloneDX/cyclonedx-ruby-gem' runs-on: ubuntu-latest + timeout-minutes: 10 needs: test + permissions: + contents: write + id-token: write + environment: release steps: - - run: echo "RubyGems publish (dummy step)" + - name: Checkout Code + # see https://github.com/actions/checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Set up Ruby + # see https://github.com/ruby/setup-ruby + uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0 + with: + ruby-version: ruby + bundler-cache: false + - name: "Push gem to RubyGems" + uses: rubygems/release-gem@6317d8d1f7e28c24d28f6eff169ea854948bd9f7 # v1.2.0 github_release: name: GitHub Release From 4f806b7e0bec63548c9d53c9b4938cb0c0381add Mon Sep 17 00:00:00 2001 From: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> Date: Thu, 2 Jul 2026 22:07:10 +0000 Subject: [PATCH 03/10] Bump actions/checkout from v6.0.2 to v7.0.0 Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 26af4c5..3191ae3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Checkout Code # see https://github.com/actions/checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: Set up Ruby @@ -41,7 +41,7 @@ jobs: steps: - name: Checkout Code # see https://github.com/actions/checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: Set up Ruby @@ -65,7 +65,7 @@ jobs: steps: - name: Checkout Code # see https://github.com/actions/checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: Create GitHub Release From 7ff9329721386599b85baf3dbb176d60e07eb4a2 Mon Sep 17 00:00:00 2001 From: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> Date: Thu, 2 Jul 2026 23:40:05 +0000 Subject: [PATCH 04/10] Bump ruby/setup-ruby GHA from v1.310.0 to v1.314.0 Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3191ae3..5421d3d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: persist-credentials: false - name: Set up Ruby # see https://github.com/ruby/setup-ruby - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0 + uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0 with: ruby-version: '3.3.9' bundler-cache: false @@ -46,7 +46,7 @@ jobs: persist-credentials: false - name: Set up Ruby # see https://github.com/ruby/setup-ruby - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0 + uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0 with: ruby-version: ruby bundler-cache: false From 2106cb1e4e21dfd64ec1f691fd6ce24af1b43ef4 Mon Sep 17 00:00:00 2001 From: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> Date: Sat, 4 Jul 2026 11:20:45 +0000 Subject: [PATCH 05/10] Replace github.ref_name with GITHUB_REF_NAME in release job Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5421d3d..cfdfb18 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,7 +70,7 @@ jobs: persist-credentials: false - name: Create GitHub Release run: | - gh release create "${{ github.ref_name }}" \ + gh release create "$GITHUB_REF_NAME" \ --verify-tag \ --generate-notes env: From 3e9e0baf59565c0dde93c81875a1f57b469c3420 Mon Sep 17 00:00:00 2001 From: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> Date: Sat, 4 Jul 2026 11:34:11 +0000 Subject: [PATCH 06/10] Trigger release workflow only on vMAJOR.MINOR.PATCH tags Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cfdfb18..23a7c58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Release on: push: - tags: ["v*"] + tags: ["v*.*.*"] permissions: contents: read From e3c2541c0e39fb0451fc5945fc1213192fb7c1e8 Mon Sep 17 00:00:00 2001 From: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> Date: Sat, 4 Jul 2026 14:51:38 +0000 Subject: [PATCH 07/10] Add comment explaining required permissions for GitHub Releases Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23a7c58..0ef54f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,6 +60,8 @@ jobs: 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 steps: From 51b50f12e9a96adf8dff477dc6810a1b76ac9604 Mon Sep 17 00:00:00 2001 From: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> Date: Sat, 4 Jul 2026 19:17:58 +0000 Subject: [PATCH 08/10] Add comments explaining required permissions for RubyGems Releases Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ef54f3..96bcac0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,8 +35,8 @@ jobs: timeout-minutes: 10 needs: test permissions: - contents: write - id-token: write + contents: write # Required for `rake release` to perform git synchronization. + id-token: write # Required for Trusted Publishing authentication. environment: release steps: - name: Checkout Code From da61dd344cec201b9a0ef290a1ac3b017b56e5b7 Mon Sep 17 00:00:00 2001 From: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> Date: Sat, 4 Jul 2026 19:35:37 +0000 Subject: [PATCH 09/10] Add comment with rubygems/release-gem GHA project URL Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 96bcac0..a2584b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,6 +51,7 @@ jobs: ruby-version: ruby bundler-cache: false - name: "Push gem to RubyGems" + # see https://github.com/rubygems/release-gem uses: rubygems/release-gem@6317d8d1f7e28c24d28f6eff169ea854948bd9f7 # v1.2.0 github_release: From 9e506408dc9143257bf1fff73505179fbc02c893 Mon Sep 17 00:00:00 2001 From: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> Date: Mon, 6 Jul 2026 01:48:40 +0000 Subject: [PATCH 10/10] Add support for creating GitHub pre-releases Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com> --- .github/workflows/release.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2584b4..c4a4f44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,8 +73,14 @@ jobs: persist-credentials: false - name: Create GitHub Release run: | - gh release create "$GITHUB_REF_NAME" \ - --verify-tag \ - --generate-notes + 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" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}