Use reusable workflow for build & push

pull/4/head
Robert Adam 2022-05-07 18:51:34 +02:00
rodzic dd4ccc579c
commit d20b031f01
3 zmienionych plików z 76 dodań i 50 usunięć

Wyświetl plik

@ -1,50 +0,0 @@
name: Publish Docker image
on:
workflow_dispatch:
inputs:
mumble-version:
description: "The version (tag or commit hash) of Mumble to build"
required: true
default: "latest"
docker-version:
description: "Docker image version, independent of mumble version"
required: true
default: 0
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set mumble-version if manual trigger
if: "${{ github.event.inputs.mumble-version != '' }}"
run: echo "MUMBLE_VERSION=${{ github.event.inputs.mumble-version }}" >> $GITHUB_ENV
- name: Set docker-version if manual trigger
if: "${{ github.event.inputs.docker-version != '' }}"
run: echo "DOCKER_VERSION=${{ github.event.inputs.docker-version }}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Build
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: true
build-args: |
MUMBLE_VERSION=${{ env.MUMBLE_VERSION }}
tags: mumblevoip/mumble-server:latest,mumblevoip/mumble-server:${{ env.MUMBLE_VERSION }},,mumblevoip/mumble-server:${{ env.MUMBLE_VERSION }}-${{ env.DOCKER_VERSION }}

Wyświetl plik

@ -0,0 +1,49 @@
name: Build and Publish
on:
workflow_call:
inputs:
mumble_version:
required: true
type: string
docker_version:
required: true
type: string
platforms:
required: true
type: string
publish:
required: true
type: boolean
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Build
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: ${{ inputs.publish }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: ${{ inputs.platforms }}
push: ${{ inputs.publish }}
build-args: |
MUMBLE_VERSION=${{ inputs.mumble_version }}
tags: mumblevoip/mumble-server:latest, mumblevoip/mumble-server:${{ inputs.mumble_version }}, mumblevoip/mumble-server:${{ inputs.mumble_version }}-${{ inputs.docker_version }}
env:
MUMBLE_VERSION: ${{ inputs.mumble_version }}

Wyświetl plik

@ -0,0 +1,27 @@
name: Manual dispatch
on:
workflow_dispatch:
inputs:
mumble_version:
description: "The version (tag or commit hash) of Mumble to build"
required: true
default: "latest"
docker_version:
description: "Docker image version, independent of mumble version"
required: true
default: "0"
publish:
description: "Whether the built image(s) shall be published to Dockerhub"
required: true
default: "false"
jobs:
manual_dispatch:
uses: ./.github/workflows/build_and_publish.yml
with:
mumble_version: ${{ github.event.inputs.mumble_version }}
docker_version: ${{ github.event.inputs.docker_version }}
publish: ${{ github.event.inputs.publish == 'true' }}
platforms: "linux/amd64"
secrets: inherit