Files
amneziawg-docker/.github/workflows/docker-build.yaml
T

63 lines
1.8 KiB
YAML

name: build-image
on:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
inputs:
tools_ref:
description: "amneziawg-tools tag"
required: false
env:
IMAGE: vernette/amneziawg
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Resolve refs
id: ref
run: |
TOOLS="${{ github.event.inputs.tools_ref }}"
if [ -z "$TOOLS" ]; then
TOOLS=$(curl -fsSL \
https://api.github.com/repos/amnezia-vpn/amneziawg-tools/releases/latest \
| jq -r .tag_name)
fi
echo "tools=$TOOLS" >> "$GITHUB_OUTPUT"
- name: Skip if image tag already exists
id: exists
run: |
if docker manifest inspect "$IMAGE:${{ steps.ref.outputs.tools }}" >/dev/null 2>&1; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- uses: docker/setup-qemu-action@v3
if: steps.exists.outputs.skip == 'false'
- uses: docker/setup-buildx-action@v3
if: steps.exists.outputs.skip == 'false'
- uses: docker/login-action@v3
if: steps.exists.outputs.skip == 'false'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v6
if: steps.exists.outputs.skip == 'false'
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
AWG_TOOLS_REF=${{ steps.ref.outputs.tools }}
AWG_GO_REF=${{ steps.ref.outputs.go }}
tags: |
${{ env.IMAGE }}:${{ steps.ref.outputs.tools }}
${{ env.IMAGE }}:latest