mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-20 01:46:11 +00:00
See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
71 lines
2.2 KiB
YAML
71 lines
2.2 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
push:
|
|
branches: master
|
|
paths:
|
|
- 'src/Impostor.Server/**'
|
|
- 'src/Impostor.Shared/**'
|
|
- '.github/workflows/docker.yml'
|
|
- 'Dockerfile'
|
|
tags:
|
|
- 'v*.*.*'
|
|
pull_request:
|
|
paths:
|
|
- 'src/Impostor.Server/**'
|
|
- 'src/Impostor.Shared/**'
|
|
- '.github/workflows/docker.yml'
|
|
- 'Dockerfile'
|
|
|
|
jobs:
|
|
push_to_registry:
|
|
name: Push Docker image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Prepare
|
|
id: prep
|
|
run: |
|
|
DOCKER_IMAGE=aeonlucid/impostor
|
|
VERSION=noop
|
|
VERSIONSUFFIX=docker
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
VERSIONSUFFIX=none
|
|
elif [[ $GITHUB_REF == refs/heads/* ]]; then
|
|
VERSION=nightly
|
|
VERSIONSUFFIX=docker.${{ github.run_number }}
|
|
elif [[ $GITHUB_REF == refs/pull/* ]]; then
|
|
VERSION=pr-${{ github.event.number }}
|
|
VERSIONSUFFIX=pr.${{ github.event.number }}
|
|
fi
|
|
TAGS="${DOCKER_IMAGE}:${VERSION}"
|
|
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
|
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
|
|
fi
|
|
echo version=${VERSION} >> $GITHUB_OUTPUT
|
|
echo tags=${TAGS} >> $GITHUB_OUTPUT
|
|
echo versionsuffix=${VERSIONSUFFIX} >> $GITHUB_OUTPUT
|
|
echo created=$(date -u +'%Y-%m-%dT%H:%M:%SZ') >> $GITHUB_OUTPUT
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Login to DockerHub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.prep.outputs.tags }}
|
|
build-args: |
|
|
VERSIONSUFFIX=${{ steps.prep.outputs.versionsuffix }}
|