diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8ac91f2..d067bd4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2,8 +2,8 @@ name: ci
on:
push:
- branches:
- - main
+ tags:
+ - 'v*'
jobs:
ci:
@@ -16,27 +16,36 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- - name: Log in to the Container registry
- uses: docker/login-action@v3
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/kejadlen/caddy-tailscale
+ tags: |
+ type=semver,pattern={{version}}
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
+ - name: Log in to the Container registry
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Strip the v prefix from the tag
+ run: |
+ TAG=${{ github.ref_name }}
+ echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
+ build-args: |
+ CADDY_VERSION=${{ env.VERSION }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha