Skip to content

Release yaml generated from https://github.com/tektoncd/pipelines-as-… #1007

Release yaml generated from https://github.com/tektoncd/pipelines-as-…

Release yaml generated from https://github.com/tektoncd/pipelines-as-… #1007

Workflow file for this run

name: Create and publish a Docker image to ghcr on main and nightly with ko
on:
push:
paths:
- "cmd/**"
- "pkg/**"
- "vendor/**"
- "go.mod"
- "go.sum"
- ".ko.yaml"
- ".github/workflows/container.yaml"
# For testing when pushing to the main repo directly on pr
# pull_request:
# paths:
# - "cmd/**"
# - "pkg/**"
# - "vendor/**"
# - "go.mod"
# - "go.sum"
# - ".ko.yaml"
# - ".github/workflows/container.yaml"
env:
PLATFORMS: linux/amd64,linux/arm64,linux/ppc64le
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version-file: "go.mod"
- uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
- name: Build and push images
shell: bash
run: |
set -x
releaseBranchFormat='release-v'
if [[ ${GITHUB_REF_NAME} == ${releaseBranchFormat}* ]]; then
tag=v$(echo ${GITHUB_REF_NAME}|sed "s,${releaseBranchFormat},,")
elif [[ ${GITHUB_REF} == refs/pull/* ]]; then
tag=pr-$(echo ${GITHUB_REF} | cut -c11-|sed 's,/merge,,')
else
# Sanitize the tag by replacing invalid characters with hyphens
tag=$(echo ${GITHUB_REF_NAME}|sed 's,/merge,,' | sed 's,[/.],-,g')
fi
for image in ./cmd/*;do
ko build -B -t "${tag}" --platform="${{ env.PLATFORMS }}" "${image}"
done