-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 1.51 KB
/
build.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
name: Build
on:
workflow_call:
inputs:
push:
type: boolean
default: false
force-deploy:
type: boolean
default: false
outputs:
version:
value: ${{ jobs.build-docker.outputs.version }}
workflow_dispatch:
inputs:
push:
description: Push images
type: boolean
default: false
env:
push: ${{ inputs.push }}
ghcr_token: ${{ secrets.GHCR_TOKEN}}
jobs:
build-docker:
name: Docker build
runs-on: ubuntu-latest
strategy:
matrix:
project:
- hmpps-github-actions-runner
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Set version
id: version
run: |
version=$(date '+%Y-%m-%d').${{ github.run_number }}.$(echo ${{ github.sha }} | cut -c1-7)
echo "version=$version" | tee -a "$GITHUB_OUTPUT"
- name: GitHub app JWT and installation access token generation
uses: jamestrousdale/github-app-jwt-token@0.1.4
id: generate-github-app-tokens
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Build Docker images
uses: ./.github/actions/docker-build
id: build
with:
project: ${{ matrix.project }}
push: ${{ env.push }}
version: ${{ steps.version.outputs.version }}
gh_auth_token: ${{ steps.generate-github-app-tokens.outputs.access-token }}