1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-09-19 15:21:36 +02:00
theme.park/.github/workflows/docker-build.yml

118 lines
4.1 KiB
YAML
Raw Normal View History

2022-03-20 17:16:25 +01:00
name: docker build
on:
release:
2022-03-20 18:20:11 +01:00
types:
2022-03-22 10:05:36 +01:00
- released
2022-03-23 20:48:47 +01:00
workflow_dispatch:
2022-03-23 21:23:58 +01:00
inputs:
branch:
description: 'Select branch'
required: true
type: choice
options:
2022-04-02 15:15:18 +02:00
- master
- develop
2022-03-31 20:54:30 +02:00
- testing
2022-03-23 21:46:48 +01:00
tag:
description: 'Add a tag'
2022-03-22 10:05:36 +01:00
push:
branches:
2022-04-02 15:15:18 +02:00
- develop
2022-03-31 20:54:30 +02:00
- testing
2022-03-23 21:23:58 +01:00
paths-ignore:
- '.github/**'
2022-03-20 17:16:25 +01:00
jobs:
2022-04-02 15:15:18 +02:00
build-and-push-it-to-the-limit:
2022-03-20 17:16:25 +01:00
runs-on: ubuntu-latest
2022-04-02 19:07:32 +02:00
strategy:
matrix:
architecture: [armhf, aarch64, amd64]
2022-03-20 17:16:25 +01:00
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
2022-04-02 19:07:32 +02:00
- name: Prepare
id: prep
run: |
ARCHITECTURE=${{ matrix.architecture }}
echo ::set-output name=VERSION::${{ github.event.release.tag_name }}
2022-04-02 19:47:25 +02:00
echo ::set-output name=platform::${ARCHITECTURE}
2022-03-20 17:16:25 +01:00
- name: Set current date as env variable
id: date_time
run: echo ::set-output name=NOW::$(date +'%Y-%m-%dT%H:%M:%S')
2022-04-02 15:15:18 +02:00
2022-03-31 20:54:30 +02:00
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
2022-04-02 15:15:18 +02:00
2022-03-31 20:54:30 +02:00
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
2022-04-02 15:15:18 +02:00
2022-03-31 20:54:30 +02:00
- name: Docker meta
2022-04-02 15:15:18 +02:00
id: metadata
2022-03-31 20:54:30 +02:00
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/gilbn/theme.park
2022-04-02 15:15:18 +02:00
gilbn/theme.park
2022-03-31 20:54:30 +02:00
tags: |
2022-04-02 15:15:18 +02:00
type=ref,event=branch
2022-03-20 17:16:25 +01:00
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT }}
2022-04-02 15:15:18 +02:00
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DH_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build&push master
if: ${{ github.event.release.target_commitish == 'master' }}
uses: docker/build-push-action@v2
with:
2022-04-02 19:47:25 +02:00
file: ./Dockerfile.${{ matrix.architecture }}
2022-04-02 19:48:41 +02:00
platforms: ${{ matrix.architecture }}
2022-04-02 15:15:18 +02:00
push: ${{ github.event_name != 'pull_request' }}
2022-04-02 19:07:32 +02:00
tags: latest, ${{ steps.prep.outputs.VERSION }}
2022-04-02 15:15:18 +02:00
labels: ${{ steps.metadata.outputs.labels }}
2022-04-02 19:07:32 +02:00
build-args: TP_RELEASE=${{ steps.prep.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}
2022-04-02 15:15:18 +02:00
- name: manual build&push master
if: ${{ github.event.inputs.branch == 'master' }}
uses: docker/build-push-action@v2
with:
2022-04-02 19:47:25 +02:00
file: ./Dockerfile.${{ matrix.architecture }}
2022-04-02 19:48:41 +02:00
platforms: ${{ matrix.architecture }}
2022-04-02 15:15:18 +02:00
push: ${{ github.event_name != 'pull_request' }}
2022-04-02 15:44:56 +02:00
tags: latest, ${{ github.event.inputs.tag }}
2022-04-02 15:15:18 +02:00
labels: ${{ steps.metadata.outputs.labels }}
2022-04-02 19:07:32 +02:00
build-args: TP_RELEASE=${{ steps.prep.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}
2022-04-02 15:15:18 +02:00
- name: build&push develop
if: ${{ github.ref == 'refs/heads/develop' || github.event.inputs.branch == 'develop' }}
uses: docker/build-push-action@v2
with:
2022-04-02 19:47:25 +02:00
file: ./Dockerfile.${{ matrix.architecture }}
2022-04-02 19:48:41 +02:00
platforms: ${{ matrix.architecture }}
2022-04-02 15:15:18 +02:00
push: ${{ github.event_name != 'pull_request' }}
2022-04-02 15:44:56 +02:00
tags: ${{ steps.metadata.outputs.tags }}
2022-04-02 15:15:18 +02:00
labels: ${{ steps.metadata.outputs.labels }}
2022-04-02 19:07:32 +02:00
build-args: TP_RELEASE=${{ steps.prep.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}
2022-04-02 15:15:18 +02:00
2022-03-31 20:54:30 +02:00
- name: build&push testing
if: ${{ github.ref == 'refs/heads/testing' || github.event.inputs.branch == 'testing' }}
uses: docker/build-push-action@v2
2022-03-20 17:36:31 +01:00
with:
2022-04-02 19:10:05 +02:00
file: ./Dockerfile.${{ matrix.architecture }}
2022-04-02 19:48:41 +02:00
platforms: ${{ matrix.architecture }}
2022-03-31 20:54:30 +02:00
push: ${{ github.event_name != 'pull_request' }}
2022-04-02 15:44:56 +02:00
tags: ${{ steps.metadata.outputs.tags }}
2022-03-31 20:54:30 +02:00
labels: ${{ steps.metadata.outputs.labels }}
2022-04-02 19:47:25 +02:00
build-args: TP_RELEASE=${{ steps.prep.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}, PLATFORM=${{ steps.prep.outputs.platform }}