Browse Source

workflow update

pull/354/head
GilbN 3 years ago
parent
commit
13f1550d90
  1. 62
      .github/workflows/docker-build.yml

62
.github/workflows/docker-build.yml

@ -10,16 +10,19 @@ on:
required: true required: true
type: choice type: choice
options: options:
- master
- develop
- testing - testing
tag: tag:
description: 'Add a tag' description: 'Add a tag'
push: push:
branches: branches:
- develop
- testing - testing
paths-ignore: paths-ignore:
- '.github/**' - '.github/**'
jobs: jobs:
push_to_ghcr_io: build-and-push-it-to-the-limit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
@ -29,36 +32,81 @@ jobs:
- name: Get the version - name: Get the version
id: get_version id: get_version
run: echo ::set-output name=VERSION::${{ github.event.release.tag_name }} run: echo ::set-output name=VERSION::${{ github.event.release.tag_name }}
- name: Set current date as env variable - name: Set current date as env variable
id: date_time id: date_time
run: echo ::set-output name=NOW::$(date +'%Y-%m-%dT%H:%M:%S') run: echo ::set-output name=NOW::$(date +'%Y-%m-%dT%H:%M:%S')
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Docker meta - name: Docker meta
id: metadata # you'll use this in the next step id: metadata
uses: docker/metadata-action@v3 uses: docker/metadata-action@v3
with: with:
# list of Docker images to use as base name for tags
images: | images: |
ghcr.io/gilbn/theme.park ghcr.io/gilbn/theme.park
# Docker tags based on the following events/attributes gilbn/theme.park
tags: | tags: |
testing type=ref,event=branch
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT }} password: ${{ secrets.GH_PAT }}
- 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' }}
tags: ${{ steps.metadata.outputs.tags }}, latest, latest-${{ runner.arch }}
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' }}
tags: ${{ steps.metadata.outputs.tags }}, latest, ${{ github.event.inputs.tag }}, latest-${{ runner.arch }}
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' }}
tags: ${{ steps.metadata.outputs.tags }}, develop-${{ runner.arch }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: TP_RELEASE=${{ steps.get_version.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}
- name: build&push testing - name: build&push testing
if: ${{ github.ref == 'refs/heads/testing' || github.event.inputs.branch == 'testing' }} if: ${{ github.ref == 'refs/heads/testing' || github.event.inputs.branch == 'testing' }}
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 platforms: linux/amd64,linux/arm/v7,linux/arm64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metadata.outputs.tags }} tags: ${{ steps.metadata.outputs.tags }}, testing-${{ runner.arch }}
labels: ${{ steps.metadata.outputs.labels }} labels: ${{ steps.metadata.outputs.labels }}
build-args: TP_RELEASE=${{ steps.get_version.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}

Loading…
Cancel
Save