-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Bence Csati <[email protected]> feat(ci): add release pipeline flow Signed-off-by: Bence Csati <[email protected]> feat(ci): add release pipeline flow Signed-off-by: Bence Csati <[email protected]> feat(ci): add release pipeline flow Signed-off-by: Bence Csati <[email protected]> feat(ci): add release pipeline flow Signed-off-by: Bence Csati <[email protected]> feat(ci): add release pipeline flow Signed-off-by: Bence Csati <[email protected]>
- Loading branch information
Showing
6 changed files
with
161 additions
and
82 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,131 @@ | ||
name: Artifacts | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
publish: | ||
description: 'Publish artifacts' | ||
required: true | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
container-image: | ||
name: Container-Image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Set up Cosign | ||
if: ${{ inputs.publish }} | ||
uses: sigstore/[email protected] | ||
|
||
- name: Gather build metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
flavor: | | ||
latest = false | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr,prefix=pr- | ||
type=semver,pattern={{raw}} | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
if: ${{ inputs.publish }} | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- name: Build Docker image | ||
uses: docker/build-push-action@v6 | ||
if: ${{ inputs.publish == false }} | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
outputs: type=oci,dest=image.tar | ||
|
||
- name: Build and push Docker image | ||
id: build | ||
uses: docker/build-push-action@v6 | ||
if: ${{ inputs.publish == true }} | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
outputs: type=image, push=true | ||
|
||
- name: Sign image with GitHub OIDC Token | ||
if: ${{ inputs.publish && github.repository_owner == 'csatib02' }} | ||
env: | ||
DIGEST: ${{ inputs.publish && steps.build.outputs.digest }} | ||
TAGS: ${{ steps.meta.outputs.tags }} | ||
run: | | ||
images="" | ||
for tag in ${TAGS}; do | ||
images+="${tag}@${DIGEST} " | ||
done | ||
cosign sign --yes ${images} | ||
- name: Upload image artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Kube-Pod-Autocomplete image | ||
path: image.tar | ||
|
||
binary: | ||
name: Binary | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: '.go-version' | ||
|
||
- name: Run GoReleaser ~ Build | ||
uses: goreleaser/goreleaser-action@v6 | ||
if : ${{ inputs.publish == false }} | ||
with: | ||
distribution: goreleaser | ||
version: '~> v2' | ||
args: release --skip=publish --snapshot | ||
|
||
- name: Run GoReleaser ~ Release | ||
uses: goreleaser/goreleaser-action@v6 | ||
if: ${{ inputs.publish == true }} | ||
with: | ||
distribution: goreleaser | ||
version: '~> v2' | ||
args: goreleaser release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload binary artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Kube-Pod-Autocomplete-Binary | ||
path: build/dist |
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,17 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
- "v[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+" | ||
|
||
jobs: | ||
artifacts: | ||
name: Artifacts | ||
uses: ./.github/workflows/artifacts.yaml | ||
with: | ||
publish: true | ||
permissions: | ||
contents: read | ||
packages: write |
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
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