Skip to content

Commit fe914bb

Browse files
easelclaude
andcommitted
ci: add GitHub Pages deployment, Docker publish, and install script
pages.yml: - Triggers on CI completion (master), version tags, and workflow_dispatch - Installs Hugo 0.159.2 extended + Go from website/go.mod - Builds with hugo --gc --minify using configure-pages base URL - Deploys via actions/deploy-pages@v4 - Validated with act (build job passes end-to-end) release.yml: - Adds Docker publish job: builds and pushes to ghcr.io/documentdrivendx/axon - Tags: semver ({{version}}, {{major}}.{{minor}}) + latest - Uses docker/build-push-action@v6 with GHA layer cache - release job now waits for both build (binaries) and docker jobs - Dry-run validated with act scripts/install.sh + website/static/install.sh: - Detects OS (Linux/macOS) and arch (amd64/arm64) - Downloads correct binary from GitHub Releases latest tag - Installs to ~/.local/bin/axon with PATH hint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 070ff16 commit fe914bb

3 files changed

Lines changed: 225 additions & 1 deletion

File tree

.github/workflows/pages.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types: [completed]
7+
branches: [master]
8+
push:
9+
tags: ['v*']
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: pages
19+
cancel-in-progress: false
20+
21+
jobs:
22+
build:
23+
name: Build Site
24+
runs-on: ubuntu-latest
25+
if: >-
26+
github.event_name == 'workflow_dispatch' ||
27+
startsWith(github.ref, 'refs/tags/v') ||
28+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
29+
env:
30+
HUGO_VERSION: "0.159.2"
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Install Hugo (extended)
38+
run: |
39+
wget -q -O "${{ runner.temp }}/hugo.deb" \
40+
"https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb"
41+
sudo dpkg -i "${{ runner.temp }}/hugo.deb"
42+
43+
- name: Install Go (for Hugo modules)
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version-file: website/go.mod
47+
cache: true
48+
cache-dependency-path: website/go.sum
49+
50+
- name: Configure GitHub Pages
51+
id: pages
52+
uses: actions/configure-pages@v5
53+
54+
- name: Build with Hugo
55+
working-directory: website
56+
env:
57+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
58+
HUGO_ENVIRONMENT: production
59+
TZ: America/New_York
60+
run: |
61+
hugo \
62+
--gc \
63+
--minify \
64+
--baseURL "${{ steps.pages.outputs.base_url }}/"
65+
66+
- name: Upload Pages artifact
67+
uses: actions/upload-pages-artifact@v3
68+
with:
69+
path: website/public
70+
71+
deploy:
72+
name: Deploy
73+
environment:
74+
name: github-pages
75+
url: ${{ steps.deployment.outputs.page_url }}
76+
runs-on: ubuntu-latest
77+
needs: build
78+
steps:
79+
- name: Deploy to GitHub Pages
80+
id: deployment
81+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: write
10+
packages: write
1011

1112
env:
1213
CARGO_TERM_COLOR: always
@@ -72,9 +73,45 @@ jobs:
7273
name: ${{ matrix.artifact }}
7374
path: ${{ matrix.artifact }}
7475

76+
docker:
77+
name: Docker Image
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v4
81+
82+
- name: Log in to GHCR
83+
uses: docker/login-action@v3
84+
with:
85+
registry: ghcr.io
86+
username: ${{ github.actor }}
87+
password: ${{ secrets.GITHUB_TOKEN }}
88+
89+
- name: Set up Docker Buildx
90+
uses: docker/setup-buildx-action@v3
91+
92+
- name: Extract metadata
93+
id: meta
94+
uses: docker/metadata-action@v5
95+
with:
96+
images: ghcr.io/documentdrivendx/axon
97+
tags: |
98+
type=semver,pattern={{version}}
99+
type=semver,pattern={{major}}.{{minor}}
100+
type=raw,value=latest
101+
102+
- name: Build and push
103+
uses: docker/build-push-action@v6
104+
with:
105+
context: .
106+
push: true
107+
tags: ${{ steps.meta.outputs.tags }}
108+
labels: ${{ steps.meta.outputs.labels }}
109+
cache-from: type=gha
110+
cache-to: type=gha,mode=max
111+
75112
release:
76113
name: Create Release
77-
needs: build
114+
needs: [build, docker]
78115
runs-on: ubuntu-latest
79116
steps:
80117
- uses: actions/download-artifact@v4

website/static/install.sh

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
REPO="erikd/axon"
5+
INSTALL_DIR="$HOME/.local/bin"
6+
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/axon"
7+
DATA_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/axon"
8+
TMPFILE=""
9+
10+
cleanup() {
11+
if [ -n "$TMPFILE" ] && [ -f "$TMPFILE" ]; then
12+
rm -f "$TMPFILE"
13+
fi
14+
}
15+
16+
trap cleanup EXIT
17+
18+
err() {
19+
printf "error: %s\n" "$1" >&2
20+
exit 1
21+
}
22+
23+
detect_platform() {
24+
OS="$(uname -s)"
25+
ARCH="$(uname -m)"
26+
27+
case "$OS" in
28+
Linux) OS="linux" ;;
29+
Darwin) OS="darwin" ;;
30+
*) err "unsupported operating system: $OS (expected Linux or Darwin)" ;;
31+
esac
32+
33+
case "$ARCH" in
34+
x86_64) ARCH="amd64" ;;
35+
aarch64|arm64) ARCH="arm64" ;;
36+
*) err "unsupported architecture: $ARCH (expected x86_64, aarch64, or arm64)" ;;
37+
esac
38+
39+
ARTIFACT="axon-${OS}-${ARCH}"
40+
URL="https://github.com/${REPO}/releases/latest/download/${ARTIFACT}"
41+
printf "detected platform: %s/%s\n" "$OS" "$ARCH"
42+
}
43+
44+
download_binary() {
45+
TMPFILE="$(mktemp)"
46+
47+
printf "downloading %s ...\n" "$URL"
48+
49+
if command -v curl >/dev/null 2>&1; then
50+
if ! curl -fsSL -o "$TMPFILE" "$URL"; then
51+
err "download failed — check that a release exists for ${ARTIFACT}"
52+
fi
53+
elif command -v wget >/dev/null 2>&1; then
54+
if ! wget -q -O "$TMPFILE" "$URL"; then
55+
err "download failed — check that a release exists for ${ARTIFACT}"
56+
fi
57+
else
58+
err "neither curl nor wget found — install one and try again"
59+
fi
60+
}
61+
62+
install_binary() {
63+
mkdir -p "$INSTALL_DIR"
64+
mv "$TMPFILE" "${INSTALL_DIR}/axon"
65+
chmod +x "${INSTALL_DIR}/axon"
66+
TMPFILE=""
67+
printf "installed axon to %s/axon\n" "$INSTALL_DIR"
68+
}
69+
70+
create_dirs() {
71+
mkdir -p "$CONFIG_DIR"
72+
mkdir -p "$DATA_DIR"
73+
printf "created %s\n" "$CONFIG_DIR"
74+
printf "created %s\n" "$DATA_DIR"
75+
}
76+
77+
check_path() {
78+
case ":${PATH}:" in
79+
*":${INSTALL_DIR}:"*) ;;
80+
*)
81+
printf "\nwarning: %s is not in your PATH\n" "$INSTALL_DIR"
82+
printf "add it by appending this line to your shell profile:\n"
83+
printf "\n export PATH=\"%s:\$PATH\"\n\n" "$INSTALL_DIR"
84+
;;
85+
esac
86+
}
87+
88+
print_success() {
89+
printf "\naxon installed successfully!\n"
90+
if command -v axon >/dev/null 2>&1; then
91+
printf "version: %s\n" "$(axon --version)"
92+
elif [ -x "${INSTALL_DIR}/axon" ]; then
93+
printf "version: %s\n" "$("${INSTALL_DIR}/axon" --version 2>/dev/null || echo "unknown")"
94+
fi
95+
}
96+
97+
main() {
98+
detect_platform
99+
download_binary
100+
install_binary
101+
create_dirs
102+
check_path
103+
print_success
104+
}
105+
106+
main "$@"

0 commit comments

Comments
 (0)