Skip to content

Commit 44ba3b8

Browse files
committed
chore: extract animus-journal-postgres to standalone public repo (v0.1.0)
0 parents  commit 44ba3b8

12 files changed

Lines changed: 4223 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Release Binaries
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
dry_run_note:
10+
description: Optional context for manual non-publishing release validation.
11+
required: false
12+
type: string
13+
14+
jobs:
15+
build:
16+
name: Build (${{ matrix.target }})
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- os: ubuntu-latest
23+
target: x86_64-unknown-linux-gnu
24+
- os: macos-15-intel
25+
target: x86_64-apple-darwin
26+
- os: macos-latest
27+
target: aarch64-apple-darwin
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Install Rust toolchain
34+
uses: dtolnay/rust-toolchain@stable
35+
with:
36+
targets: ${{ matrix.target }}
37+
38+
- name: Cache Cargo build artifacts
39+
uses: Swatinem/rust-cache@v2
40+
with:
41+
shared-key: release-${{ matrix.target }}
42+
43+
- name: Compute crate name
44+
id: crate
45+
shell: bash
46+
run: |
47+
set -euo pipefail
48+
NAME="$(awk -F\" '/^name *=/ { print $2; exit }' Cargo.toml)"
49+
echo "name=${NAME}" >> "$GITHUB_OUTPUT"
50+
51+
- name: Compute release version
52+
id: version
53+
shell: bash
54+
run: |
55+
set -euo pipefail
56+
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
57+
VERSION="${GITHUB_REF#refs/tags/}"
58+
else
59+
VERSION="dev-$(echo "${GITHUB_SHA}" | cut -c1-7)"
60+
fi
61+
echo "value=${VERSION}" >> "$GITHUB_OUTPUT"
62+
63+
- name: Verify tag matches Cargo.toml version
64+
if: startsWith(github.ref, 'refs/tags/v')
65+
shell: bash
66+
run: |
67+
set -euo pipefail
68+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
69+
CARGO_VERSION="$(awk -F\" '/^version *=/ { print $2; exit }' Cargo.toml)"
70+
if [[ "${TAG_VERSION}" != "${CARGO_VERSION}" ]]; then
71+
echo "::error::release tag v${TAG_VERSION} does not match Cargo.toml [package] version ${CARGO_VERSION}; bump Cargo.toml before tagging" >&2
72+
exit 1
73+
fi
74+
echo "tag v${TAG_VERSION} matches Cargo.toml version ${CARGO_VERSION}"
75+
76+
- name: Install Linux build deps
77+
if: contains(matrix.target, 'linux')
78+
run: |
79+
sudo apt-get update
80+
sudo apt-get install -y libdbus-1-dev pkg-config
81+
82+
- name: Build release binary
83+
shell: bash
84+
run: cargo build --release --target ${{ matrix.target }}
85+
86+
- name: Stage artifact
87+
shell: bash
88+
run: |
89+
set -euo pipefail
90+
NAME="${{ steps.crate.outputs.name }}"
91+
VERSION="${{ steps.version.outputs.value }}"
92+
TARGET="${{ matrix.target }}"
93+
STAGE="${NAME}-${VERSION}-${TARGET}"
94+
ARCHIVE="${STAGE}.tar.gz"
95+
96+
mkdir -p "${STAGE}"
97+
cp "target/${TARGET}/release/${NAME}" "${STAGE}/${NAME}"
98+
tar -czf "${ARCHIVE}" "${STAGE}"
99+
shasum -a 256 "${ARCHIVE}" | awk '{print $1}' > "${ARCHIVE}.sha256"
100+
echo "archive=${ARCHIVE}" >> "$GITHUB_ENV"
101+
102+
- name: Upload archive artifact
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: ${{ steps.crate.outputs.name }}-${{ matrix.target }}
106+
path: |
107+
${{ env.archive }}
108+
${{ env.archive }}.sha256
109+
if-no-files-found: error
110+
111+
publish:
112+
name: Publish GitHub release (tags only)
113+
runs-on: ubuntu-latest
114+
needs: build
115+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
116+
permissions:
117+
contents: write
118+
119+
steps:
120+
- name: Download build artifacts
121+
uses: actions/download-artifact@v4
122+
with:
123+
path: dist
124+
125+
- name: Collect release assets
126+
shell: bash
127+
run: |
128+
set -euo pipefail
129+
ASSETS_DIR="dist/release-assets"
130+
mkdir -p "${ASSETS_DIR}"
131+
find dist -type f \( -name '*.tar.gz' -o -name '*.tar.gz.sha256' \) ! -path "${ASSETS_DIR}/*" -exec cp {} "${ASSETS_DIR}/" \;
132+
ls -la "${ASSETS_DIR}"
133+
134+
- name: Publish release
135+
uses: softprops/action-gh-release@v2
136+
with:
137+
files: dist/release-assets/*
138+
fail_on_unmatched_files: true
139+
generate_release_notes: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

0 commit comments

Comments
 (0)