mirror of
https://github.com/jbowdre/tailscale-docker.git
synced 2024-11-22 01:52:18 +00:00
72 lines
1.9 KiB
YAML
72 lines
1.9 KiB
YAML
|
name: Build Containers
|
||
|
|
||
|
# Controls when the workflow will run
|
||
|
on:
|
||
|
workflow_dispatch:
|
||
|
push:
|
||
|
branches:
|
||
|
- "main"
|
||
|
- "dev"
|
||
|
- "v*.*.*"
|
||
|
paths:
|
||
|
- "k8s/**"
|
||
|
|
||
|
permissions:
|
||
|
contents: read
|
||
|
packages: write
|
||
|
|
||
|
env:
|
||
|
REGISTRY: ghcr.io
|
||
|
IMAGE_NAME: ${{ github.repository }}
|
||
|
|
||
|
jobs:
|
||
|
build:
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
# Get the repositery's code
|
||
|
- name: Checkout
|
||
|
uses: actions/checkout@v2
|
||
|
|
||
|
# https://github.com/docker/setup-qemu-action
|
||
|
- name: Set up QEMU
|
||
|
uses: docker/setup-qemu-action@v1
|
||
|
# https://github.com/docker/setup-buildx-action
|
||
|
- name: Set up Docker Buildx
|
||
|
id: buildx
|
||
|
uses: docker/setup-buildx-action@v1
|
||
|
|
||
|
- name: Login to the Container registry
|
||
|
if: github.event_name != 'pull_request'
|
||
|
uses: docker/login-action@v1
|
||
|
with:
|
||
|
registry: ${{ env.REGISTRY }}
|
||
|
username: ${{ github.repository_owner }}
|
||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||
|
|
||
|
- name: Extract metadata (tags, labels) for Docker
|
||
|
id: meta
|
||
|
uses: docker/metadata-action@v3
|
||
|
with:
|
||
|
images: |
|
||
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||
|
# generate Docker tags based on the following events/attributes
|
||
|
tags: |
|
||
|
type=schedule
|
||
|
type=ref,event=branch
|
||
|
type=ref,event=pr
|
||
|
type=semver,pattern={{version}}
|
||
|
type=semver,pattern={{major}}.{{minor}}
|
||
|
type=semver,pattern={{major}}
|
||
|
type=sha
|
||
|
flavor: |
|
||
|
latest=true
|
||
|
|
||
|
- name: Build and push
|
||
|
uses: docker/build-push-action@v2
|
||
|
with:
|
||
|
context: images/tailscale/.
|
||
|
platforms: linux/amd64,linux/arm64
|
||
|
push: ${{ github.event_name != 'pull_request' }}
|
||
|
tags: ${{ steps.meta.outputs.tags }}
|
||
|
labels: ${{ steps.meta.outputs.labels }}
|