Skip to content

feat(ci): add release pipeline flow #1

feat(ci): add release pipeline flow

feat(ci): add release pipeline flow #1

Workflow file for this run

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
uses: sigstore/cosign-installer@v3.6.0
- 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
g

Check failure on line 94 in .github/workflows/artifacts.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/artifacts.yaml

Invalid workflow file

You have an error in your yaml syntax on line 94
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