mirror of
https://github.com/pyrohost/pyrodactyl.git
synced 2026-04-06 04:01:58 +02:00
73 lines
2.4 KiB
YAML
73 lines
2.4 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ['Release']
|
|
types:
|
|
- completed
|
|
push:
|
|
branches:
|
|
- release/**
|
|
- main
|
|
release:
|
|
types:
|
|
- published
|
|
|
|
permissions:
|
|
packages: write
|
|
|
|
jobs:
|
|
push:
|
|
name: Push
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Code checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.workflow_run.head_branch || github.ref }}
|
|
|
|
- name: Docker metadata
|
|
id: docker_meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/pyrohost/pyrodactyl
|
|
flavor: |
|
|
latest=auto
|
|
tags: |
|
|
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
|
|
type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease }}
|
|
type=ref,event=tag
|
|
type=raw,value=${{ github.event.workflow_run.head_branch || github.ref_name }},enable=${{ startsWith(github.ref, 'refs/heads/release/') }}
|
|
|
|
- name: Setup QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Setup Docker buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Update version
|
|
if: "github.event_name == 'release' && github.event.action == 'published'"
|
|
env:
|
|
REF: ${{ github.event.release.tag_name }}
|
|
run: |
|
|
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:1}',/" config/app.php
|
|
|
|
- name: Build and Push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|