-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (62 loc) · 2.11 KB
/
docker.yml
File metadata and controls
70 lines (62 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Docker Image
on:
workflow_run:
workflows: ["Release"]
types: [completed]
workflow_dispatch:
inputs:
version:
description: 'TPS version to bake into image (e.g. 0.5.1)'
required: true
permissions:
contents: read
packages: write
jobs:
build-and-push:
name: Build & Push
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
- name: Determine version
id: version
env:
INPUT_VERSION: ${{ inputs.version }}
run: |
if [ -n "$INPUT_VERSION" ]; then
# Validate: must be semver-like (digits and dots only)
if ! echo "$INPUT_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+'; then
echo "❌ Invalid version: $INPUT_VERSION" && exit 1
fi
echo "tps_version=$INPUT_VERSION" >> "$GITHUB_OUTPUT"
echo "tag=$INPUT_VERSION" >> "$GITHUB_OUTPUT"
else
# Read version from package.json (workflow_run trigger)
V=$(node -p "require('./packages/cli/package.json').version")
echo "tps_version=$V" >> "$GITHUB_OUTPUT"
echo "tag=$V" >> "$GITHUB_OUTPUT"
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
TPS_VERSION=${{ steps.version.outputs.tps_version }}
tags: |
ghcr.io/tpsdev-ai/tps-office:${{ steps.version.outputs.tag }}
ghcr.io/tpsdev-ai/tps-office:latest
cache-from: type=gha
cache-to: type=gha,mode=max