Skip to content

Commit 72fe0fd

Browse files
committed
Added release job
1 parent b8283cb commit 72fe0fd

1 file changed

Lines changed: 65 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,78 @@ jobs:
188188
echo "- \`${{ env.DOCKERHUB_IMAGE }}:latest\` → AMD64 standard image" >> $GITHUB_STEP_SUMMARY
189189
echo "- \`${{ env.GHCR_IMAGE }}:latest\` → AMD64 standard image" >> $GITHUB_STEP_SUMMARY
190190
191+
# ===========================================================================
192+
# Release Job - Create GitHub Release (only on tag push)
193+
# ===========================================================================
194+
release:
195+
name: Create GitHub Release
196+
needs: build
197+
if: startsWith(github.ref, 'refs/tags/v')
198+
runs-on: ubuntu-latest
199+
permissions:
200+
contents: write
201+
202+
steps:
203+
- name: Checkout repository
204+
uses: actions/checkout@v4
205+
with:
206+
fetch-depth: 0 # Full history for release notes
207+
208+
- name: Generate release notes
209+
id: notes
210+
run: |
211+
VERSION="${{ needs.build.outputs.version }}"
212+
213+
# Create release body
214+
cat << EOF > release_notes.md
215+
## Docker Images
216+
217+
### Standard Images (debian:trixie-slim)
218+
| Architecture | Docker Hub | GitHub Container Registry |
219+
|--------------|------------|---------------------------|
220+
| AMD64 | \`dotstartech/mqbase:${VERSION}-amd64\` | \`ghcr.io/dotstartech/mqbase:${VERSION}-amd64\` |
221+
| ARM64 | \`dotstartech/mqbase:${VERSION}-arm64\` | \`ghcr.io/dotstartech/mqbase:${VERSION}-arm64\` |
222+
223+
### Distroless Images (minimal, no shell)
224+
| Architecture | Docker Hub | GitHub Container Registry |
225+
|--------------|------------|---------------------------|
226+
| AMD64 | \`dotstartech/mqbase:${VERSION}-amd64-distroless\` | \`ghcr.io/dotstartech/mqbase:${VERSION}-amd64-distroless\` |
227+
| ARM64 | \`dotstartech/mqbase:${VERSION}-arm64-distroless\` | \`ghcr.io/dotstartech/mqbase:${VERSION}-arm64-distroless\` |
228+
229+
### Quick Start
230+
\`\`\`bash
231+
docker run -d --name mqbase -p 1883:1883 -p 8080:8080 -p 9001:9001 dotstartech/mqbase:${VERSION}
232+
\`\`\`
233+
234+
Open http://localhost:8080 and log in with \`admin:admin\`.
235+
236+
---
237+
238+
EOF
239+
240+
- name: Create GitHub Release
241+
uses: softprops/action-gh-release@v2
242+
with:
243+
name: mqBase v${{ needs.build.outputs.version }}
244+
body_path: release_notes.md
245+
generate_release_notes: true # Appends auto-generated notes from commits
246+
draft: false
247+
prerelease: ${{ contains(needs.build.outputs.version, '-') }}
248+
env:
249+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
250+
191251
# ===========================================================================
192252
# Deploy Job - Runs on self-hosted runner on production server
193253
# ===========================================================================
194254
deploy:
195255
name: Deploy to Production
196256
needs: build
197257
# Only deploy on tag push OR when manually triggered with deploy=true
198-
if: startsWith(github.ref, 'refs/tags/v') || inputs.deploy == true
258+
# Note: runs after release job completes (if it ran) due to GitHub's job ordering
259+
if: |
260+
always() &&
261+
needs.build.result == 'success' &&
262+
(startsWith(github.ref, 'refs/tags/v') || inputs.deploy == true)
199263
runs-on: [self-hosted, linux, production]
200264
environment: production # Requires approval from reviewers
201265

0 commit comments

Comments
 (0)