forked from linkong/planet
84 lines
2.8 KiB
YAML
84 lines
2.8 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
# Tagged production releases are published on demand from the workstation.
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: gitea.rclaw.top
|
|
IMAGE_NAMESPACE: linkong/planet
|
|
|
|
jobs:
|
|
images:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Login to registry
|
|
env:
|
|
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
|
run: printf '%s' "$REGISTRY_PASSWORD" | docker login "$REGISTRY" -u "$REGISTRY_USER" --password-stdin
|
|
- name: Publish immutable production images
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
run: |
|
|
export PLANET_RELEASE_DOCKER_CONFIG="${DOCKER_CONFIG:-$HOME/.docker}"
|
|
python3 scripts/production_release.py "$GITHUB_REF_NAME"
|
|
- name: Build and push staging images
|
|
if: "!startsWith(github.ref, 'refs/tags/v')"
|
|
run: |
|
|
for service in frontend admin backend aiprovider; do
|
|
extra_build_args=""
|
|
case "$service" in
|
|
frontend)
|
|
dockerfile="./frontend/Dockerfile"
|
|
context="./frontend"
|
|
;;
|
|
admin)
|
|
dockerfile="./frontend/Dockerfile"
|
|
context="./frontend"
|
|
extra_build_args="--build-arg PLANET_FRONTEND_TARGET=admin"
|
|
;;
|
|
backend)
|
|
dockerfile="backend/Dockerfile"
|
|
context="."
|
|
;;
|
|
aiprovider)
|
|
dockerfile="aiprovider/Dockerfile"
|
|
context="."
|
|
;;
|
|
esac
|
|
|
|
image="$REGISTRY/$IMAGE_NAMESPACE/$service:$GITHUB_SHA"
|
|
docker build $extra_build_args -t "$image" -f "$dockerfile" "$context"
|
|
docker push "$image"
|
|
done
|
|
|
|
client_release:
|
|
needs: images
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Bun
|
|
run: curl -fsSL https://bun.sh/install | bash
|
|
- name: Build, test, and package Earth client
|
|
working-directory: client
|
|
env:
|
|
ELECTRON_MIRROR: https://cdn.npmmirror.com/binaries/electron/
|
|
ELECTRON_BUILDER_BINARIES_MIRROR: https://registry.npmmirror.com/-/binary/electron-builder-binaries/
|
|
run: |
|
|
~/.bun/bin/bun install --frozen-lockfile
|
|
~/.bun/bin/bun test
|
|
~/.bun/bin/bun run dist:all
|
|
- name: Publish Gitea Release with client packages
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN || github.token }}
|
|
run: |
|
|
python3 scripts/release_publish.py \
|
|
--tag "${GITHUB_REF_NAME}" \
|
|
--assets-dir client/release \
|
|
--changelog docs/CHANGELOG.md
|