1
0
mirror of https://github.com/phusion/baseimage-docker.git synced 2026-03-26 20:38:58 +00:00
Files
baseimage-docker/.github/workflows/main.yml
2022-03-16 17:04:07 +02:00

74 lines
2.5 KiB
YAML

name: Release
on:
workflow_dispatch:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=phusion/baseimage
GIT_BRANCH=${GITHUB_REF##*/}
# Set the platforms to build for here and thus reduce duplicating it.
PLATFORMS=amd64,arm,arm64,riscv64
TAGS="${DOCKER_IMAGE}:${GIT_BRANCH}, ghcr.io/${{ github.repository_owner }}/baseimage:${GIT_BRANCH}"
# Set output parameters.
if [ "${{github.event_name}}" == "pull_request" ]; then
echo ::set-output name=push::false
else
echo ::set-output name=push::true
echo ::set-output name=tags::${TAGS}
echo ::set-output name=branch::${GIT_BRANCH}
echo ::set-output name=docker_image::${DOCKER_IMAGE}
fi
echo ::set-output name=platforms::${PLATFORMS}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: ${{ steps.prep.outputs.platforms }}
- name: Login to GHCR (Github Container Registry)
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:latest
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: image
platforms: ${{ steps.prep.outputs.platforms }}
push: ${{ steps.prep.outputs.push }}
tags: ${{ steps.prep.outputs.tags }}