Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow dispatch for building docker images #1034

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,46 @@ name: Build
on:
release:
types: [published]
workflow_dispatch:
inputs:
repository:
description: Repository
ref:
description: Ref
tag:
description: Tag
required: true
default: faforever/faf-python-server:latest

jobs:
docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: faforever/faf-python-server
tags:
type=semver,pattern={{raw}}

- name: Extract tag name
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and publish docker image
uses: docker/build-push-action@v1.1.1
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
repository: faforever/faf-python-server
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
build_args: GITHUB_REF=${{ steps.vars.outputs.tag }}
tag_with_ref: true

- name: Build and publish docker image
uses: docker/build-push-action@v6
with:
build-args: GITHUB_REF=${{ github.ref_name }}
tags: ${{ inputs.tag || steps.meta.outputs.tags }}
push: true
Loading