1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-11-09 12:42:40 +01:00
theme.park/.github/workflows/docker-build.yml

113 lines
3.8 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
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get the version
id: get_version
2022-03-20 20:29:34 +01:00
run: echo ::set-output name=VERSION::${{ github.event.release.tag_name }}
2022-04-02 15:15:18 +02:00
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:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
2022-04-02 18:40:11 +02:00
tags: latest, ${{ steps.get_version.outputs.VERSION }}
2022-04-02 15:15:18 +02:00
labels: ${{ steps.metadata.outputs.labels }}
build-args: TP_RELEASE=${{ steps.get_version.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}
- name: manual build&push master
if: ${{ github.event.inputs.branch == 'master' }}
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
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 }}
build-args: TP_RELEASE=${{ steps.get_version.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}
- name: build&push develop
if: ${{ github.ref == 'refs/heads/develop' || github.event.inputs.branch == 'develop' }}
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
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 }}
build-args: TP_RELEASE=${{ steps.get_version.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}
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-03-31 20:54:30 +02:00
context: .
2022-04-02 18:40:11 +02:00
platforms: amd64,arm32v7,arm64v8
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 15:15:18 +02:00
build-args: TP_RELEASE=${{ steps.get_version.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}