Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/workflows/publish_pipedv1_exp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: publish_pipedv1_exp

on:
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g. v0.1.0)"
required: true

permissions:

env:
GO_VERSION: 1.24.1
GHCR: ghcr.io
GCR: gcr.io

jobs:
binary:
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Build binary artifacts
run: |
make build/go MOD=pipedv1 BUILD_OS=linux BUILD_ARCH=amd64 BIN_SUFFIX=_${{ inputs.version }}_linux_amd64
make build/go MOD=pipedv1 BUILD_OS=linux BUILD_ARCH=arm64 BIN_SUFFIX=_${{ inputs.version }}_linux_arm64
make build/go MOD=pipedv1 BUILD_OS=darwin BUILD_ARCH=amd64 BIN_SUFFIX=_${{ inputs.version }}_darwin_amd64
make build/go MOD=pipedv1 BUILD_OS=darwin BUILD_ARCH=arm64 BIN_SUFFIX=_${{ inputs.version }}_darwin_arm64

- name: Publish binary artifacts
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2.2.1
with:
tag_name: pipedv1/exp/${{ inputs.version }}
name: pipedv1 experimental ${{ inputs.version }}
target_commitish: ${{ github.sha }}
draft: true
make_latest: "false"
files: |
./.artifacts/pipedv1_${{ inputs.version }}_linux_amd64
./.artifacts/pipedv1_${{ inputs.version }}_linux_arm64
./.artifacts/pipedv1_${{ inputs.version }}_darwin_amd64
./.artifacts/pipedv1_${{ inputs.version }}_darwin_arm64

container_image:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
strategy:
matrix:
container_registry:
- ghcr.io/pipe-cd
- gcr.io/pipecd
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

# Setup QEMU and Buildx.
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1

# Login to push container images.
- name: Log in to GHCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.GHCR }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to GCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.GCR }}
username: _json_key
password: ${{ secrets.GCR_SA }}

# Building and pushing container images.
- name: Build and push pipedv1 experimental image
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
push: true
context: .
file: cmd/pipedv1/Dockerfile
tags: ${{ matrix.container_registry }}/pipe-cd/pipedv1-exp:${{ inputs.version }}
platforms: linux/amd64,linux/arm64
# parameter to use inline cache. ref; https://docs.docker.com/build/ci/github-actions/cache/#inline-cache
cache-from: type=registry,ref=${{ matrix.container_registry }}/pipe-cd/pipedv1-exp:latest
cache-to: type=inline
21 changes: 21 additions & 0 deletions cmd/pipedv1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM golang:1.24.1 AS builder

ARG TARGETOS
ARG TARGETARCH

WORKDIR /app

COPY go.* ./
RUN go mod download

COPY . ./

RUN make build/go MOD=pipedv1 BUILD_OS=${TARGETOS} BUILD_ARCH=${TARGETARCH}

# https://github.com/pipe-cd/pipecd/pkgs/container/piped-base/459025001?tag=v0.52.0-97-g3e3df6d
FROM ghcr.io/pipe-cd/piped-base@sha256:fc2bde38211a80ee0df6d90ed168c817f30a7d0dbe8a0aff872a93ffb7d40a66

COPY --from=builder /app/.artifacts/pipedv1 /usr/local/bin/piped

ENTRYPOINT ["/sbin/tini", "--", "piped"]