62 lines
1.8 KiB
YAML
62 lines
1.8 KiB
YAML
name: "@luzzle/web.proxy"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- '@luzzle/web.proxy@*'
|
|
paths:
|
|
- 'packages/web/proxy/**'
|
|
- '.github/workflows/web-proxy.yml'
|
|
|
|
jobs:
|
|
build-push:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Check Version
|
|
if: github.ref_type == 'tag'
|
|
run: |
|
|
VERSION_FROM_PKG=$(node -p "require('./packages/web/proxy/package.json').version")
|
|
TAG_NAME=${GITHUB_REF#refs/tags/}
|
|
VERSION_FROM_TAG=${TAG_NAME#@luzzle/web.proxy@}
|
|
|
|
if [ "$VERSION_FROM_TAG" != "$VERSION_FROM_PKG" ]; then
|
|
echo "Version mismatch: Tag version $VERSION_FROM_TAG does not match package.json version $VERSION_FROM_PKG"
|
|
exit 1
|
|
fi
|
|
echo "Version $VERSION_FROM_PKG matches."
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ghcr.io/eleith/luzzle-web-proxy
|
|
tags: |
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
type=match,pattern=@luzzle/web.proxy@(\d+),group=1
|
|
type=match,pattern=@luzzle/web.proxy@(\d+\.\d+),group=1
|
|
type=match,pattern=@luzzle/web.proxy@(\d+\.\d+\.\d+),group=1
|
|
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
file: packages/web/proxy/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|