github: Add a manual workflow for building and pushing docker images
This commit is contained in:
1 parent
bf58d32dc4
commit
64b27a1c56
1 file changed
+71
@@ -0,0 +1,71 @@
|
|||||||
|
name: Build docker images
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
commit:
|
||||||
|
description: 'Commit to extract from'
|
||||||
|
type: string
|
||||||
|
branch:
|
||||||
|
description: 'Branch to extract from'
|
||||||
|
type: string
|
||||||
|
login:
|
||||||
|
description: 'Log in to Docker Hub'
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
push:
|
||||||
|
description: 'Push the built images'
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
TAG: ${{steps.get-parameters.outputs.TAG}}
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: dawidd6/action-download-artifact@v2
|
||||||
|
with:
|
||||||
|
workflow: build.yml
|
||||||
|
workflow_conclusion: success
|
||||||
|
commit: ${{inputs.commit}}
|
||||||
|
branch: ${{inputs.branch}}
|
||||||
|
event: push
|
||||||
|
name: parameters
|
||||||
|
- name: Fetch build variables
|
||||||
|
id: get-parameters
|
||||||
|
run: |
|
||||||
|
cat parameters.txt >> $GITHUB_OUTPUT
|
||||||
|
cat $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
docker-build:
|
||||||
|
needs: [prepare]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { file: Dockerfile, maintag: latest, prefix: }
|
||||||
|
- { file: Dockerfile.dev, maintag: dev, prefix: dev- }
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }}
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
if: ${{inputs.login}}
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{secrets.DOCKER_USERNAME}}
|
||||||
|
password: ${{secrets.DOCKER_PASSWORD}}
|
||||||
|
- name: Build Docker images
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{inputs.push}}
|
||||||
|
file: ./${{matrix.file}}
|
||||||
|
tags: |
|
||||||
|
mstorsjo/llvm-mingw:${{matrix.maintag}}
|
||||||
|
mstorsjo/llvm-mingw:${{matrix.prefix}}${{needs.prepare.outputs.TAG}}
|
||||||
|
- name: Inspect Docker images
|
||||||
|
run: |
|
||||||
|
docker images
|
||||||
Reference in new issue
Block a user