Skip to content

Commit b4c931f

Browse files
Copilotmikkihugo
andcommitted
Add GitHub-only release workflow (no Hex.pm key required)
- Add .github/workflows/release-github-only.yml for releases without Hex.pm - Update scripts/release.sh to support both modes (github/hex) - Update RELEASING.md with both options clearly documented Usage: ./scripts/release.sh 0.1.0 # GitHub only (default) ./scripts/release.sh 0.1.0 github # GitHub only (explicit) ./scripts/release.sh 0.1.0 hex # GitHub + Hex.pm (requires HEX_API_KEY) Co-authored-by: mikkihugo <17744793+mikkihugo@users.noreply.github.com>
1 parent 54819fd commit b4c931f

3 files changed

Lines changed: 175 additions & 20 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: GitHub Release Only
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
# Run CI tests first
10+
ci:
11+
name: CI Tests
12+
runs-on: ubuntu-latest
13+
14+
services:
15+
postgres:
16+
image: tembo/pgmq:latest
17+
env:
18+
POSTGRES_USER: postgres
19+
POSTGRES_PASSWORD: postgres
20+
POSTGRES_DB: singularity_workflow_test
21+
options: >-
22+
--health-cmd pg_isready
23+
--health-interval 10s
24+
--health-timeout 5s
25+
--health-retries 5
26+
ports:
27+
- 5432:5432
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up Elixir
33+
uses: erlef/setup-beam@v1
34+
with:
35+
elixir-version: '1.19'
36+
otp-version: '28'
37+
38+
- name: Verify PostgreSQL and pgmq
39+
run: |
40+
until pg_isready -h localhost -U postgres; do sleep 1; done
41+
PGPASSWORD=postgres psql -h localhost -U postgres -c "CREATE DATABASE IF NOT EXISTS singularity_workflow_test;"
42+
PGPASSWORD=postgres psql -h localhost -U postgres -d singularity_workflow_test -c "CREATE EXTENSION IF NOT EXISTS pgmq;"
43+
44+
- name: Restore dependencies cache
45+
uses: actions/cache@v4
46+
with:
47+
path: deps
48+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
49+
restore-keys: ${{ runner.os }}-mix-
50+
51+
- name: Install dependencies
52+
run: mix deps.get
53+
54+
- name: Run tests
55+
run: mix test
56+
env:
57+
MIX_ENV: test
58+
POSTGRES_USER: postgres
59+
POSTGRES_PASSWORD: postgres
60+
POSTGRES_DB: singularity_workflow_test
61+
POSTGRES_HOST: localhost
62+
63+
- name: Check formatting
64+
run: mix format --check-formatted
65+
66+
- name: Run Credo
67+
run: mix credo --strict
68+
69+
- name: Run security audit
70+
run: mix sobelow --exit-on-warning
71+
72+
# Create GitHub Release (no Hex.pm)
73+
release:
74+
name: Create GitHub Release
75+
needs: ci
76+
runs-on: ubuntu-latest
77+
78+
steps:
79+
- uses: actions/checkout@v4
80+
81+
- name: Extract version from tag
82+
id: version
83+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
84+
85+
- name: Create GitHub Release
86+
uses: softprops/action-gh-release@v1
87+
with:
88+
name: Release v${{ steps.version.outputs.VERSION }}
89+
body_path: CHANGELOG.md
90+
generate_release_notes: true
91+
draft: false
92+
prerelease: false
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
96+
- name: Release Summary
97+
run: |
98+
echo "✅ GitHub Release v${{ steps.version.outputs.VERSION }} created successfully!"
99+
echo ""
100+
echo "📦 To publish to Hex.pm later, run:"
101+
echo " mix hex.publish"

RELEASING.md

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,45 @@
11
# Release Process for Singularity.Workflow
22

3-
This document describes how to publish a new release of Singularity.Workflow to Hex.pm.
3+
This document describes how to publish a new release of Singularity.Workflow.
4+
5+
## Two Release Options
6+
7+
### Option 1: GitHub Release Only (No Hex.pm API Key Required)
8+
9+
For creating GitHub releases without publishing to Hex.pm:
10+
11+
```bash
12+
./scripts/release.sh 0.1.0 github
13+
```
14+
15+
This uses `.github/workflows/release-github-only.yml` and:
16+
- Runs all CI tests automatically
17+
- Creates GitHub release with changelog
18+
- No Hex.pm credentials needed
19+
- You can publish to Hex.pm manually later
20+
21+
### Option 2: Full Release (GitHub + Hex.pm)
22+
23+
For publishing to both GitHub and Hex.pm:
24+
25+
```bash
26+
./scripts/release.sh 0.1.0 hex
27+
```
28+
29+
This uses `.github/workflows/publish.yml` and requires:
30+
- HEX_API_KEY secret configured
31+
- Production environment for manual approval
32+
- Publishes to Hex.pm automatically
433

534
## Prerequisites
635

7-
Before creating a release, ensure:
36+
### For GitHub-Only Releases
837

9-
1. **HEX_API_KEY Secret**: Add your Hex.pm API key to GitHub repository secrets
10-
- Go to repository Settings → Secrets and variables → Actions
11-
- Create a new secret named `HEX_API_KEY`
12-
- Get your API key from: https://hex.pm/dashboard/keys
38+
No setup required - just push the tag.
39+
40+
### For Hex.pm Releases
1341

42+
1. **HEX_API_KEY Secret**: Add your Hex.pm API key to GitHub repository secrets
1443
2. **Production Environment**: Configure manual approval for releases
1544
- Go to repository Settings → Environments
1645
- Create an environment named `production`
@@ -20,13 +49,23 @@ Before creating a release, ensure:
2049

2150
## Quick Release
2251

23-
Use the automated release script:
52+
### GitHub Only (Default)
2453

2554
```bash
2655
./scripts/release.sh 0.1.0
2756
```
2857

29-
This will:
58+
or explicitly:
59+
60+
```bash
61+
./scripts/release.sh 0.1.0 github
62+
```
63+
64+
### GitHub + Hex.pm
65+
66+
```bash
67+
./scripts/release.sh 0.1.0 hex
68+
```
3069
- Create a git tag `v0.1.0`
3170
- Push the tag to GitHub
3271
- Trigger the automated publish workflow

scripts/release.sh

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
set -e
66

77
VERSION=${1:-"0.1.0"}
8+
MODE=${2:-"github"} # "github" or "hex"
89

9-
echo "🚀 Preparing to release version ${VERSION}"
10+
echo "🚀 Preparing to release version ${VERSION} (mode: ${MODE})"
1011
echo ""
1112

1213
# Check if we're on a clean branch
@@ -33,15 +34,29 @@ git push origin "v${VERSION}"
3334
echo ""
3435
echo "✅ Tag v${VERSION} pushed successfully!"
3536
echo ""
36-
echo "📦 GitHub Actions workflow will now:"
37-
echo " 1. Run all tests and quality checks"
38-
echo " 2. Wait for manual approval in the 'production' environment"
39-
echo " 3. Publish to Hex.pm (requires HEX_API_KEY secret)"
40-
echo " 4. Create a GitHub release with changelog"
41-
echo ""
42-
echo "🔗 Monitor progress at:"
43-
echo " https://github.com/Singularity-ng/singularity-workflows/actions"
37+
38+
if [ "$MODE" = "hex" ]; then
39+
echo "📦 GitHub Actions workflow will now:"
40+
echo " 1. Run all tests and quality checks"
41+
echo " 2. Wait for manual approval in the 'production' environment"
42+
echo " 3. Publish to Hex.pm (requires HEX_API_KEY secret)"
43+
echo " 4. Create a GitHub release with changelog"
44+
echo ""
45+
echo "🔗 Monitor progress at:"
46+
echo " https://github.com/Singularity-ng/singularity-workflows/actions/workflows/publish.yml"
47+
echo ""
48+
echo "⚙️ Setup required (if not done yet):"
49+
echo " 1. Add HEX_API_KEY secret to GitHub repository settings"
50+
echo " 2. Configure 'production' environment in repository settings for manual approval"
51+
else
52+
echo "📦 GitHub Actions workflow will now:"
53+
echo " 1. Run all tests and quality checks"
54+
echo " 2. Create a GitHub release with changelog"
55+
echo ""
56+
echo "🔗 Monitor progress at:"
57+
echo " https://github.com/Singularity-ng/singularity-workflows/actions/workflows/release-github-only.yml"
58+
echo ""
59+
echo "💡 To publish to Hex.pm later, run:"
60+
echo " mix hex.publish"
61+
fi
4462
echo ""
45-
echo "⚙️ Setup required (if not done yet):"
46-
echo " 1. Add HEX_API_KEY secret to GitHub repository settings"
47-
echo " 2. Configure 'production' environment in repository settings for manual approval"

0 commit comments

Comments
 (0)