-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor release workflow to be reusable
Signed-off-by: Danil Grigorev <danil.grigorev@suse.com>
- Loading branch information
1 parent
a06f1d6
commit 7f52ee3
Showing
4 changed files
with
247 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
on: | ||
workflow_call: | ||
secrets: | ||
REGISTRY_PASSWORD: | ||
description: Password to the registry | ||
required: true | ||
inputs: | ||
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 | ||
|
||
arch: | ||
type: string | ||
description: Architecture for the image | ||
required: true | ||
|
||
org: | ||
type: string | ||
description: Organization part of the image name | ||
required: false | ||
default: "rancher-sandbox" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
packages: write | ||
outputs: | ||
image: ${{ steps.image.outputs.image }} | ||
digest: ${{ steps.image.outputs.digest }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build the image | ||
id: image | ||
uses: ./.github/workflows/release_build | ||
with: | ||
arch: ${{ inputs.arch }} | ||
tag: ${{ inputs.tag }} | ||
org: ${{ inputs.org }} | ||
registry: ${{ inputs.registry }} | ||
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 | ||
- name: Sign image with cosign | ||
uses: ./.github/workflows/release_sign | ||
with: | ||
image: ${{ needs.build.outputs.image }} | ||
digest: ${{ needs.build.outputs.digest }} | ||
identity: https://github.com/${{ inputs.org }}/rancher-turtles/.github/workflows/release.yaml@refs/tags/${{ inputs.tag }} | ||
oids-issuer: https://token.actions.githubusercontent.com | ||
registry: ${{ inputs.registry }} | ||
username: ${{ inputs.username }} | ||
password: ${{ secrets[inputs.password] }} | ||
|
||
provenance: | ||
needs: [sign, build] | ||
permissions: | ||
actions: read | ||
id-token: write | ||
packages: write | ||
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v1.9.0 | ||
with: | ||
image: ${{ needs.build.outputs.image }} | ||
digest: ${{ needs.build.outputs.digest }} | ||
secrets: | ||
registry-username: ${{ inputs.username }} | ||
registry-password: ${{ secrets[inputs.password] }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.