Merge pull request #33 from tpsdev-ai/release-0.5.2 #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Image | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| 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 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Determine version | |
| id: version | |
| env: | |
| INPUT_VERSION: ${{ inputs.version }} | |
| REF_NAME: ${{ github.ref_name }} | |
| 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 | |
| V="${REF_NAME#v}" | |
| 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 |