Skip to content

Commit 592067a

Browse files
authored
refactor: consolidate release pipeline with draft-first pattern (#124)
## What Collapse the three separate release workflows (release.yaml, release-image.yaml, release-discussion.yaml) into a single release.yaml reusable workflow using a draft-first pattern: create draft, push tags, build artifacts (optional GoReleaser, optional Docker image), create discussion, then publish. Preserve the legacy release-image.yaml and release-discussion.yaml as stubs that fail with migration instructions. ## Why The three workflows were always chained and shared data flow, so callers had to wire up three workflow calls and reason about ordering themselves. The draft-first sequence supports repositories with immutable releases enabled by ensuring every artifact and attestation lands before the release becomes visible. ## Notes - Breaking: callers of release-image.yaml / release-discussion.yaml hit a deprecation error with migration instructions. - Breaking: update-major-tag input removed; the major tag is always pushed in create_release. - publish defaults to true and is backwards compatible, but release-drafter always creates a draft first and publish_release handles the final flip. - publish_release uses always() with per-job result checks so it runs when optional jobs are skipped but blocks on any failure. - GoReleaser config is validated via yq to require release.disable: true, avoiding conflict with the draft. - Attestation steps probe repo visibility via the GitHub API and warn on private repos instead of failing cryptically. - release_discussion always spins up a runner when a tag is created and skips at the step level if secrets are missing (job-level if: cannot read secrets). - publish_release uses -F draft=false (capital F) to send a boolean rather than a string. Signed-off-by: jmeridth <jmeridth@gmail.com>
1 parent 84f2a3c commit 592067a

8 files changed

Lines changed: 486 additions & 176 deletions

File tree

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: "Release Discussion"
2+
name: "Release Discussion (Deprecated)"
33
on:
44
workflow_call:
55
inputs:
@@ -16,37 +16,17 @@ on:
1616
required: true
1717
discussion-category-id:
1818
required: true
19-
permissions:
20-
contents: read
19+
20+
permissions: {}
21+
2122
jobs:
22-
create_discussion:
23+
deprecated:
2324
runs-on: ubuntu-latest
24-
permissions:
25-
contents: read
26-
discussions: write
27-
env:
28-
DISCUSSION_REPOSITORY_ID: ${{ secrets.discussion-repository-id }}
29-
DISCUSSION_CATEGORY_ID: ${{ secrets.discussion-category-id }}
25+
permissions: {}
3026
steps:
31-
- name: Harden the runner (Audit all outbound calls)
32-
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
33-
with:
34-
egress-policy: audit
35-
- name: Check for Discussion Repository ID
36-
if: ${{ env.DISCUSSION_REPOSITORY_ID == '' }}
27+
- name: Deprecation notice
3728
run: |
38-
echo "discussion-repository-id secret is not set"
29+
echo "::error::This workflow (release-discussion.yaml) has been deprecated and consolidated into release.yaml."
30+
echo "::error::Migrate to the consolidated release workflow by setting the 'discussion-category-id' and 'discussion-repository-id' secrets on release.yaml instead."
31+
echo "::error::See migration guide: https://github.com/github-community-projects/ospo-reusable-workflows/blob/main/docs/release-discussion.md"
3932
exit 1
40-
- name: Check for Discussion Category ID
41-
if: ${{ env.DISCUSSION_CATEGORY_ID == '' }}
42-
run: |
43-
echo "discussion-category-id secret is not set"
44-
exit 1
45-
- name: Create an Announcement Discussion for Release
46-
uses: abirismyname/create-discussion@c2b7c825241769dda523865ae444a879f6bbd0e0
47-
with:
48-
title: ${{ inputs.full-tag }}
49-
body: ${{ inputs.body }}
50-
repository-id: ${{ env.DISCUSSION_REPOSITORY_ID }}
51-
category-id: ${{ env.DISCUSSION_CATEGORY_ID }}
52-
github-token: ${{ secrets.github-token }}
Lines changed: 12 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: "Release Image"
2+
name: "Release Image (Deprecated)"
33
on:
44
workflow_call:
55
inputs:
@@ -25,56 +25,17 @@ on:
2525
required: true
2626
image-registry-password:
2727
required: true
28-
permissions:
29-
contents: read
28+
29+
permissions: {}
30+
3031
jobs:
31-
create_action_images:
32+
deprecated:
3233
runs-on: ubuntu-latest
33-
permissions:
34-
contents: read
35-
packages: write
36-
id-token: write
37-
attestations: write
38-
env:
39-
IMAGE_REGISTRY: ${{ secrets.image-registry }}
40-
IMAGE_REGISTRY_USERNAME: ${{ secrets.image-registry-username }}
41-
IMAGE_REGISTRY_PASSWORD: ${{ secrets.image-registry-password }}
34+
permissions: {}
4235
steps:
43-
- name: Harden the runner (Audit all outbound calls)
44-
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
45-
with:
46-
egress-policy: audit
47-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
48-
with:
49-
persist-credentials: false
50-
- name: Set up Docker Buildx
51-
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd
52-
- name: Log in to the Container registry
53-
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121
54-
with:
55-
registry: ${{ env.IMAGE_REGISTRY }}
56-
username: ${{ env.IMAGE_REGISTRY_USERNAME }}
57-
password: ${{ env.IMAGE_REGISTRY_PASSWORD}}
58-
- name: Push Docker Image
59-
if: ${{ success() }}
60-
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f
61-
id: push
62-
with:
63-
context: .
64-
file: ./Dockerfile
65-
push: true
66-
tags: |
67-
${{ env.IMAGE_REGISTRY }}/${{ inputs.image-name }}:latest
68-
${{ env.IMAGE_REGISTRY }}/${{ inputs.image-name }}:${{ inputs.full-tag }}
69-
${{ env.IMAGE_REGISTRY }}/${{ inputs.image-name }}:${{ inputs.short-tag }}
70-
platforms: linux/amd64,linux/arm64
71-
provenance: false
72-
sbom: false
73-
- name: Generate artifact attestation
74-
if: ${{ inputs.create-attestation }}
75-
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
76-
with:
77-
subject-name: ${{ env.IMAGE_REGISTRY }}/${{ inputs.image-name}}
78-
subject-digest: ${{ steps.push.outputs.digest }}
79-
push-to-registry: true
80-
github-token: ${{ secrets.github-token }}
36+
- name: Deprecation notice
37+
run: |
38+
echo "::error::This workflow (release-image.yaml) has been deprecated and consolidated into release.yaml."
39+
echo "::error::Migrate to the consolidated release workflow by setting the 'image-name' input on release.yaml instead."
40+
echo "::error::See migration guide: https://github.com/github-community-projects/ospo-reusable-workflows/blob/main/docs/release-image.md"
41+
exit 1

0 commit comments

Comments
 (0)