wings/.github/workflows/docker.yaml

73 lines
2.2 KiB
YAML
Raw Normal View History

2022-11-06 20:55:49 +00:00
name: Docker
2020-11-15 04:42:12 +00:00
on:
push:
branches:
- develop
2020-11-15 04:42:12 +00:00
tags:
2022-11-06 20:55:49 +00:00
- "v*"
2020-11-15 04:42:12 +00:00
jobs:
2022-11-06 20:55:49 +00:00
build-and-push:
name: Build and Push
2020-12-15 22:59:06 +00:00
runs-on: ubuntu-20.04
# Always run against a tag, even if the commit into the tag has [docker skip] within the commit message.
2020-11-15 04:42:12 +00:00
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
2022-11-06 20:55:49 +00:00
2020-11-15 04:42:12 +00:00
steps:
2020-12-15 22:59:06 +00:00
- name: Code Checkout
2022-11-06 20:55:49 +00:00
uses: actions/checkout@v3
2020-12-15 23:08:06 +00:00
- name: Docker Meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ghcr.io/pterodactyl/wings
2022-11-06 20:55:49 +00:00
2020-12-15 22:59:06 +00:00
- name: Set up QEMU
2022-11-06 20:55:49 +00:00
uses: docker/setup-qemu-action@v2
2020-12-15 22:59:06 +00:00
- name: Install buildx
2022-11-06 20:55:49 +00:00
uses: docker/setup-buildx-action@v2
2020-12-15 22:59:06 +00:00
- name: Login to GitHub Container Registry
2022-11-06 20:55:49 +00:00
uses: docker/login-action@v2
2020-11-15 04:42:12 +00:00
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
2022-11-06 20:55:49 +00:00
2020-12-15 23:24:15 +00:00
- name: Get Build Information
id: build_info
run: |
echo "::set-output name=version_tag::${GITHUB_REF/refs\/tags\/v/}"
2020-12-15 23:24:15 +00:00
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
2022-11-06 20:55:49 +00:00
- name: Build and push (latest)
2020-11-15 04:42:12 +00:00
uses: docker/build-push-action@v2
if: "!contains(github.ref, 'develop')"
with:
2022-11-06 20:55:49 +00:00
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
2020-11-15 04:42:12 +00:00
build-args: |
2020-12-15 23:24:15 +00:00
VERSION=${{ steps.build_info.outputs.version_tag }}
2020-11-15 04:42:12 +00:00
labels: ${{ steps.docker_meta.outputs.labels }}
2020-12-15 22:59:06 +00:00
tags: ${{ steps.docker_meta.outputs.tags }}
2022-11-06 20:55:49 +00:00
- name: Build and push (develop)
2020-11-15 04:42:12 +00:00
uses: docker/build-push-action@v2
if: "contains(github.ref, 'develop')"
with:
2022-11-06 20:55:49 +00:00
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
2020-11-15 04:42:12 +00:00
build-args: |
2020-12-15 23:24:15 +00:00
VERSION=dev-${{ steps.build_info.outputs.short_sha }}
2020-11-15 04:42:12 +00:00
labels: ${{ steps.docker_meta.outputs.labels }}
2020-12-15 22:59:06 +00:00
tags: ${{ steps.docker_meta.outputs.tags }}
2022-11-06 20:55:49 +00:00
cache-from: type=gha
cache-to: type=gha,mode=max