forked from rancher/turtles
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (79 loc) · 2.5 KB
/
release.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
82
83
84
85
86
87
on:
workflow_call:
inputs:
secret_registry:
type: boolean
description: All registry related inputs should be treated as secret values
required: true
image:
type: string
description: Static image value for the build
password:
type: string
description: Registry password key to lookup in secrets
required: true
username:
type: string
description: Username for the registry login
required: true
registry:
type: string
description: Destination registry for image push
required: true
tag:
type: string
description: Tag for the built image
required: true
org:
type: string
description: Organization part of the image name
required: false
default: "rancher"
jobs:
build:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
packages: write
outputs:
digest: ${{ steps.image.outputs.digest }}
image: ${{ steps.image.outputs.image }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag }}
- name: Build the image
id: image
uses: ./.github/workflows/release_build
with:
tag: ${{ inputs.tag }}
org: ${{ inputs.org }}
registry: ${{ inputs.secret_registry && secrets[inputs.registry] || inputs.registry }}
username: ${{ inputs.secret_registry && secrets[inputs.username] || inputs.username }}
password: ${{ secrets[inputs.password] }}
sign:
runs-on: ubuntu-latest
needs: [build]
permissions:
actions: read
id-token: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag }}
- name: Sign image with cosign
uses: ./.github/workflows/release_sign
with:
image: ${{ vars[inputs.image] }}
digest: ${{ needs.build.outputs.digest }}
identity: https://github.com/${{ inputs.org }}/turtles/.github/workflows/release.yml@${{ github.ref }}
oids-issuer: https://token.actions.githubusercontent.com
registry: ${{ inputs.secret_registry && secrets[inputs.registry] || inputs.registry }}
username: ${{ inputs.secret_registry && secrets[inputs.username] || inputs.username }}
password: ${{ secrets[inputs.password] }}