Initial Homegate 0.4.0 with web UI, Compose and Gitea Actions
This commit is contained in:
105
.gitea/workflows/release.yaml
Normal file
105
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,105 @@
|
||||
name: Test and publish Homegate
|
||||
"on":
|
||||
push:
|
||||
branches: ['**']
|
||||
tags: ['v*']
|
||||
pull_request:
|
||||
|
||||
# Use a dedicated Linux runner labelled homegate:host; see REGISTRY.md.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
checks:
|
||||
runs-on: homegate
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
github-server-url: ${{ gitea.server_url }}
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
persist-credentials: false
|
||||
- name: Python environment
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test_env="$(mktemp -d "$RUNNER_TEMP/homegate-python.XXXXXX")"
|
||||
printf 'TEST_PYTHON=%s/bin/python\n' "$test_env" >> "$GITHUB_ENV"
|
||||
printf 'TEST_ENV=%s\n' "$test_env" >> "$GITHUB_ENV"
|
||||
python3 -m venv "$test_env"
|
||||
"$test_env/bin/python" -m pip install -r requirements.txt
|
||||
- name: Unit and HTTP tests
|
||||
run: '"$TEST_PYTHON" -m unittest discover -s tests -v'
|
||||
- name: JavaScript and shell syntax
|
||||
run: |
|
||||
node --check ui/dist/app.js
|
||||
for script in setup.sh run-local.sh ci/smoke_image.sh; do sh -n "$script"; done
|
||||
- name: Compose contracts
|
||||
env:
|
||||
PYTHONPATH: .
|
||||
run: '"$TEST_PYTHON" ci/check_compose.py'
|
||||
- name: Build and smoke-test runtime image
|
||||
env:
|
||||
CI_REVISION: ${{ gitea.sha }}
|
||||
run: |
|
||||
set -eu
|
||||
test_image="homegate-ci:$CI_REVISION-$$"
|
||||
trap 'docker image rm "$test_image" >/dev/null 2>&1 || true' EXIT
|
||||
docker build --build-arg VERSION="$(cat VERSION)" --tag "$test_image" .
|
||||
sh ci/smoke_image.sh "$test_image"
|
||||
- name: Clean Python environment
|
||||
if: always()
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -n "${TEST_ENV:-}" ]; then rm -rf -- "$TEST_ENV"; fi
|
||||
|
||||
publish:
|
||||
needs: checks
|
||||
if: gitea.event_name == 'push' && startsWith(gitea.ref, 'refs/tags/v')
|
||||
runs-on: homegate
|
||||
env:
|
||||
DOCKER_BUILD_SUMMARY: "false"
|
||||
DOCKER_BUILD_RECORD_UPLOAD: "false"
|
||||
steps:
|
||||
- name: Checkout release
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
github-server-url: ${{ gitea.server_url }}
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
persist-credentials: false
|
||||
- name: Validate release identity
|
||||
id: image
|
||||
env:
|
||||
CI_SERVER_URL: ${{ gitea.server_url }}
|
||||
CI_REPOSITORY: ${{ gitea.repository }}
|
||||
CI_REF: ${{ gitea.ref }}
|
||||
CI_REVISION: ${{ gitea.sha }}
|
||||
REGISTRY: ${{ vars.REGISTRY }}
|
||||
run: python3 ci/image_metadata.py
|
||||
- name: Configure cross-platform emulation
|
||||
uses: https://github.com/docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: amd64,arm64
|
||||
- name: Configure Buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v3
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: https://github.com/docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ steps.image.outputs.registry }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
- name: Publish AMD64 and ARM64 image
|
||||
uses: https://github.com/docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
build-args: |
|
||||
VERSION=${{ steps.image.outputs.version }}
|
||||
tags: |
|
||||
${{ steps.image.outputs.image }}:${{ steps.image.outputs.version }}
|
||||
${{ steps.image.outputs.image }}:sha-${{ steps.image.outputs.revision }}
|
||||
labels: |
|
||||
org.opencontainers.image.source=${{ steps.image.outputs.source }}
|
||||
org.opencontainers.image.revision=${{ steps.image.outputs.revision }}
|
||||
provenance: false
|
||||
Reference in New Issue
Block a user