don't use matrix for build #20
This file contains 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 Build and Push | |
on: | |
push: | |
branches: | |
- "main" | |
release: | |
types: [published] | |
env: | |
IMAGE_REGISTRY: ghcr.io | |
IMAGE_NAMESPACE: andreygubarev | |
IMAGE_NAME: headscale | |
IMAGE_PLATFORMS: linux/amd64,linux/arm64 | |
jobs: | |
build: | |
name: Build and push multi-arch image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Determine tags | |
id: get_tags | |
run: | | |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/v} | |
echo ::set-output name=TAG::"$VERSION" | |
else | |
echo ::set-output name=TAG::"latest" | |
fi | |
- name: Build and push | |
uses: docker/build-push-action@4 | |
with: | |
context: . | |
push: true | |
platforms: ${{ env.IMAGE_PLATFORMS }} | |
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ steps.get_tags.outputs.TAG }} |