lntip/.github/workflows/on-tag.yml

44 lines
1.1 KiB
YAML

name: Build on tag
permissions:
packages: write
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-*
jobs:
build:
name: Build image
runs-on: ubuntu-20.04
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Set env variables
run: |
echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
IMAGE_NAME="${GITHUB_REPOSITORY#*/}"
echo "IMAGE_NAME=${IMAGE_NAME//docker-/}" >> $GITHUB_ENV
- name: Login to Docker Hub
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
id: qemu
- name: Setup Docker buildx action
uses: docker/setup-buildx-action@v1
id: buildx
- name: Run Docker buildx
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$BRANCH \
--output "type=registry" ./