-
Notifications
You must be signed in to change notification settings - Fork 31
132 lines (130 loc) · 4.81 KB
/
deploy.yml
File metadata and controls
132 lines (130 loc) · 4.81 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
on:
workflow_call:
inputs:
source_repository:
description: The source repository to build from
type: string
required: true
source_ref:
description: The branch, tag or SHA to checkout and build from
type: string
required: true
source_commit:
description: The specific commit SHA to checkout (takes precedence over source_ref)
type: string
required: false
source_patch:
description: The patch to apply to the source repository
type: string
required: false
build_script:
description: The bash script path in this repository to run instead of the Docker build & push script. You must push the image yourself.
type: string
required: false
build_args:
description: Extra arguments to pass to the build script
type: string
required: false
target_tag:
description: Docker hub tag to push to
type: string
required: true
target_repository:
description: Docker hub repository to push to
type: string
required: true
target_dockerfile:
description: Dockerfile path in this repository to build from. Omit to use source repository Dockerfile
type: string
default: ./source/Dockerfile
required: false
platforms:
# eg [{"platform":"linux/amd64", "runner": "ARM64", "slug": "something-arm64"},{"platform":"linux/arm64", "runner": "ubuntu-latest", "slug": "something-amd64"}]
description: JSON list of platforms to build for
type: string
required: true
harbor_registry:
description: Harbor registry to push the images to
type: string
default: ''
required: false
HARBOR_USERNAME:
description: Harbor username
type: string
required: false
DOCKER_USERNAME:
description: Docker Hub username
type: string
required: true
GOPROXY:
description: GOPROXY
type: string
required: false
secrets:
DOCKER_PASSWORD:
required: true
HARBOR_PASSWORD:
required: false
MACOS_PASSWORD:
required: true
jobs:
deploy:
name: Deploy ${{ matrix.config.slug }} ${{ inputs.target_tag }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
config: ${{fromJson(inputs.platforms)}}
runs-on: ${{ matrix.config.runner }}
outputs:
git_commit_hash: ${{ steps.set_output.outputs.git_commit_hash }}
git_commit_hash_full: ${{ steps.set_output.outputs.git_commit_hash_full }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/install-deps
with:
repository: ${{ inputs.source_repository }}
- uses: ./.github/actions/deploy
id: deploy
with:
source_repository: ${{ inputs.source_repository }}
source_ref: ${{ inputs.source_ref }}
source_commit: ${{ inputs.source_commit }}
source_patch: ${{ inputs.source_patch }}
build_script: ${{ inputs.build_script }}
build_args: ${{ inputs.build_args }}
target_tag: ${{ inputs.target_tag }}-${{ matrix.config.slug }}
target_repository: ${{ inputs.target_repository }}
target_dockerfile: ${{ inputs.target_dockerfile }}
platform: ${{ matrix.config.platform }}
DOCKER_USERNAME: "${{ inputs.DOCKER_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.DOCKER_PASSWORD }}"
MACOS_PASSWORD: "${{ secrets.MACOS_PASSWORD }}"
GOPROXY: "${{ inputs.GOPROXY }}"
HARBOR_USERNAME: "${{ vars.HARBOR_USERNAME }}"
HARBOR_PASSWORD: "${{ secrets.HARBOR_PASSWORD }}"
harbor_registry: ${{ vars.HARBOR_REGISTRY }}
# This step captures the git commit hash from the deploy action for job output
- name: Set job output
id: set_output
run: echo "git_commit_hash=${{ steps.deploy.outputs.git_commit_hash }}" >> $GITHUB_OUTPUT
shell: bash
mainfest:
name: Manifest
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/manifest
with:
platforms: ${{ inputs.platforms }}
source_repository: ${{ inputs.source_repository }}
source_ref: ${{ inputs.source_ref }}
target_tag: ${{ inputs.target_tag }}
target_repository: ${{ inputs.target_repository }}
harbor_registry: ${{ inputs.harbor_registry }}
HARBOR_USERNAME: "${{ inputs.HARBOR_USERNAME }}"
HARBOR_PASSWORD: "${{ secrets.HARBOR_PASSWORD }}"
DOCKER_USERNAME: "${{ inputs.DOCKER_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.DOCKER_PASSWORD }}"
git_commit_hash: ${{ needs.deploy.outputs.git_commit_hash }}