2022-11-06 20:55:49 +00:00
|
|
|
name: Docker
|
|
|
|
|
2020-11-15 04:42:12 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-07-12 17:06:22 +00:00
|
|
|
- develop
|
2022-12-05 00:24:33 +00:00
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- published
|
2022-11-06 20:55:49 +00:00
|
|
|
|
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'))"
|
|
|
|
steps:
|
2022-12-05 00:24:33 +00:00
|
|
|
- name: Code checkout
|
2022-11-06 20:55:49 +00:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2022-12-05 00:39:55 +00:00
|
|
|
- name: Docker metadata
|
2020-12-15 23:08:06 +00:00
|
|
|
id: docker_meta
|
2022-12-05 00:24:33 +00:00
|
|
|
uses: docker/metadata-action@v4
|
2020-12-15 23:08:06 +00:00
|
|
|
with:
|
|
|
|
images: ghcr.io/pterodactyl/wings
|
2022-12-05 01:37:53 +00:00
|
|
|
flavor: |
|
|
|
|
latest=false
|
2022-12-05 00:24:33 +00:00
|
|
|
tags: |
|
|
|
|
type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.prerelease == false }}
|
|
|
|
type=ref,event=tag
|
|
|
|
type=ref,event=branch
|
2022-11-06 20:55:49 +00:00
|
|
|
|
2022-12-05 00:24:33 +00:00
|
|
|
- name: Setup QEMU
|
2022-11-06 20:55:49 +00:00
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
|
2022-12-05 00:39:55 +00:00
|
|
|
- name: Setup Docker 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: |
|
2022-12-05 00:29:36 +00:00
|
|
|
echo "version_tag=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT
|
|
|
|
echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
2022-11-06 20:55:49 +00:00
|
|
|
|
2022-12-05 00:24:33 +00:00
|
|
|
- name: Build and Push (tag)
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
if: "github.event_name == 'release' && github.event.action == 'published'"
|
2020-11-15 04:42:12 +00:00
|
|
|
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
|
|
|
|
2022-12-05 00:24:33 +00:00
|
|
|
- name: Build and Push (develop)
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
if: "github.event_name == 'push' && contains(github.ref, 'develop')"
|
2020-11-15 04:42:12 +00:00
|
|
|
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
|