Add Gitea release pipeline and server compose
- .gitea/workflows/release.yaml: on vX.Y.Z tags run checks, build and push the image to the Gitea registry (X.Y.Z, X.Y, latest), create a release from the CHANGELOG section - scripts/release-notes.mjs: extract changelog section, create the release - deploy/compose.yaml: server setup using the released image - APP_VERSION build arg, shown in the header Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c7cb6ed433
commit
30b01d7bca
7 files changed
+203
-1
No files matched your search
@@ -0,0 +1,63 @@
|
||||
# Push a tag vX.Y.Z (matching package.json) → checks, Docker image to the Gitea registry, release.
|
||||
#
|
||||
# Needs: an act_runner with access to a Docker daemon (default config mounts the socket),
|
||||
# and a repo secret REGISTRY_TOKEN (personal access token with package read+write).
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*.*.*"]
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
|
||||
- name: Resolve version and image name
|
||||
run: |
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
PKG_VERSION="$(node -p "require('./package.json').version")"
|
||||
if [ "$VERSION" != "$PKG_VERSION" ]; then
|
||||
echo "::error::Tag $GITHUB_REF_NAME does not match package.json version $PKG_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
node scripts/release-notes.mjs notes "$VERSION" > /dev/null
|
||||
REGISTRY="${GITHUB_SERVER_URL#https://}"
|
||||
IMAGE="$(echo "$REGISTRY/$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')"
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
|
||||
echo "REGISTRY=$REGISTRY" >> "$GITHUB_ENV"
|
||||
echo "IMAGE=$IMAGE" >> "$GITHUB_ENV"
|
||||
echo "Building $IMAGE:$VERSION"
|
||||
|
||||
- name: Checks
|
||||
run: |
|
||||
npm ci
|
||||
npm run lint
|
||||
npm run typecheck
|
||||
npm test
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
docker build \
|
||||
--build-arg APP_VERSION="$VERSION" \
|
||||
--label org.opencontainers.image.version="$VERSION" \
|
||||
--label org.opencontainers.image.revision="$GITHUB_SHA" \
|
||||
--label org.opencontainers.image.source="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
|
||||
-t "$IMAGE:$VERSION" -t "$IMAGE:${VERSION%.*}" -t "$IMAGE:latest" .
|
||||
|
||||
- name: Push image
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u "${{ github.repository_owner }}" --password-stdin
|
||||
for tag in "$VERSION" "${VERSION%.*}" latest; do docker push "$IMAGE:$tag"; done
|
||||
docker logout "$REGISTRY"
|
||||
|
||||
- name: Create release
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: node scripts/release-notes.mjs publish
|
||||
Reference in new issue
Block a user