mirror of
https://github.com/TeamPGM/PagerMaid-Pyro.git
synced 2024-11-22 07:47:42 +00:00
60 lines
1.8 KiB
YAML
60 lines
1.8 KiB
YAML
name: "Docker Build"
|
|
|
|
# Controls when the action will run.
|
|
on:
|
|
# Triggers the workflow on push or pull request events but only for the master branch
|
|
workflow_dispatch: ~
|
|
push:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
name: docker build and publish
|
|
env:
|
|
DOCKER_BUILDKIT: 1
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
DOCKERHUB_REPOSITORY: ${{ secrets.DOCKER_REPO }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
# https://github.com/docker/setup-qemu-action
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
# https://github.com/docker/setup-buildx-action
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Buildx cache
|
|
uses: actions/cache@v4
|
|
id: buildx-cache
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildx
|
|
|
|
- name: Get version
|
|
run: |
|
|
RAW_PGM_VERSION=$(python .github/get_version.py)
|
|
echo "PGM_VERSION=${RAW_PGM_VERSION}" >> "$GITHUB_ENV"
|
|
|
|
- name: Build
|
|
run: |
|
|
docker buildx build \
|
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
|
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
|
--output "type=image,push=true" \
|
|
--platform "linux/amd64,linux/arm64/v8" \
|
|
--build-arg "S6_ARCH=amd64" \
|
|
--tag "${DOCKERHUB_REPOSITORY}:latest" \
|
|
--tag "${DOCKERHUB_REPOSITORY}:${PGM_VERSION} \
|
|
-f Dockerfile \
|
|
.
|