-
Notifications
You must be signed in to change notification settings - Fork 16
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 "partially" reusable
- Loading branch information
1 parent
a06f1d6
commit a7518f5
Showing
3 changed files
with
214 additions
and
175 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
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,64 @@ | ||
name: 'Build release' | ||
description: 'Builds release image and pushes to the registry' | ||
inputs: | ||
arch: | ||
description: 'Architecture of the built image' | ||
required: true | ||
type: string | ||
tag: | ||
description: 'Image tag' | ||
type: string | ||
default: 'github-actions' | ||
org: | ||
description: 'Organization part of the image path' | ||
required: false | ||
default: 'rancher-sandbox' | ||
type: string | ||
registry: | ||
description: 'The registry to login' | ||
required: true | ||
type: string | ||
username: | ||
description: 'The username to registry' | ||
required: true | ||
type: string | ||
password: | ||
required: true | ||
description: 'The password for registry login' | ||
type: string | ||
outputs: | ||
image: | ||
description: 'Full image name' | ||
value: ${{ steps.image_info.outputs.image_name }} | ||
digest: | ||
description: 'Image digest' | ||
value: ${{ steps.image_info.outputs.digest }} | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: setupGo | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '=1.20.7' | ||
- name: Docker login to ghcr registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ inputs.registry }} | ||
username: ${{ inputs.username }} | ||
password: ${{ inputs.password }} | ||
- name: Build docker image for gh registry | ||
shell: bash | ||
run: make docker-build-${{ inputs.arch }} TAG=${{ inputs.tag }} REGISTRY=${{ inputs.registry }} ORG=${{ inputs.org }} | ||
- name: Push docker image to gh registry | ||
shell: bash | ||
run: make docker-push-${{ inputs.arch }} TAG=${{ inputs.tag }} REGISTRY=${{ inputs.registry }} ORG=${{ inputs.org }} | ||
- name: Store image and digest | ||
shell: bash | ||
id: image_info | ||
run: | | ||
img=${{ inputs.registry }}/${{ inputs.org }}/rancher-turtles-${{ inputs.arch }}:${{ inputs.tag }} | ||
out=$( docker buildx imagetools inspect ${img} --format '{{json .}}' ) | ||
digest=$( echo $out | jq .manifest.digest ) | ||
echo "digest=${digest}" >> $GITHUB_OUTPUT | ||
echo "image_name=${img%:*}" >> $GITHUB_OUTPUT |
Oops, something went wrong.