-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (56 loc) · 1.58 KB
/
build_push.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Reusable Workflow for building and pushing a docker image
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
name: Build and Push
on:
workflow_call:
inputs:
commit:
description: Full Commit Hash
type: string
required: true
tags:
description: Docker Image Tag(s)
type: string
required: true
jobs:
build-push:
name: Build and Push
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get image tags
id: tags
run: |
IFS=','
read -r -a old_tags <<<"${{ inputs.tags }}"
new_tags=()
for old_tag in "${old_tags[@]}"; do
new_tags+=("arranhs/abs-tract:$old_tag")
done
tags="${new_tags[*]}"
echo "tags=$tags" >>"$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ steps.tags.outputs.tags }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
push: true