-
Notifications
You must be signed in to change notification settings - Fork 292
81 lines (76 loc) · 2.72 KB
/
delivery-docker.yml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: delivery / docker
on:
release:
types:
- released
workflow_dispatch:
inputs:
tag_name:
description: The release tag to distribute
required: true
tag_latest:
description: Tag as latest
required: false
type: boolean
default: false
env:
REGISTRY_NAME: 'docker.io'
USER_NAME: 'buildpacksio'
IMG_NAME: 'pack'
jobs:
deliver-docker:
strategy:
matrix:
config: [tiny, base]
include:
- config: tiny
base_image: gcr.io/distroless/static
suffix:
- config: base
base_image: ubuntu:jammy
suffix: -base
runs-on: ubuntu-latest
steps:
- name: Determine version
uses: actions/github-script@v7
id: version
with:
result-encoding: string
script: |
let tag = (context.payload.release && context.payload.release.tag_name)
|| (context.payload.inputs && context.payload.inputs.tag_name);
if (!tag) {
throw "ERROR: unable to determine tag";
}
return tag.replace(/^v/, '');
- name: Checkout source at tag
uses: actions/checkout@v4
with:
ref: v${{ steps.version.outputs.result }}
- name: Determine App Name
run: 'echo "IMG_NAME=${{ env.REGISTRY_NAME }}/${{ env.USER_NAME }}/${{ env.IMG_NAME }}" >> $GITHUB_ENV'
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: buildpacks/github-actions/setup-tools@v5.8.1
- name: Buildx Build/Publish
run: |
docker buildx build . \
--tag ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }}${{ matrix.suffix }} \
--platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le \
--build-arg pack_version=${{ steps.version.outputs.result }} \
--build-arg base_image=${{ matrix.base_image }} \
--provenance=false \
--push
- name: Tag Image as Base
if: ${{ (github.event.release != '' || github.event.inputs.tag_latest) && matrix.config == 'base' }}
run: |
crane copy ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }}${{ matrix.suffix }} ${{ env.IMG_NAME }}:base
- name: Tag Image as Latest
if: ${{ (github.event.release != '' || github.event.inputs.tag_latest) && matrix.config != 'base' }}
run: |
crane copy ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }}${{ matrix.suffix }} ${{ env.IMG_NAME }}:latest