|
| 1 | +name: publish_pipedv1_exp |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: "Version to release (e.g. v0.1.0)" |
| 8 | + required: true |
| 9 | + |
| 10 | +permissions: |
| 11 | + |
| 12 | +env: |
| 13 | + GO_VERSION: 1.24.1 |
| 14 | + GHCR: ghcr.io |
| 15 | + GCR: gcr.io |
| 16 | + |
| 17 | +jobs: |
| 18 | + binary: |
| 19 | + runs-on: ubuntu-24.04 |
| 20 | + permissions: |
| 21 | + contents: write |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + - uses: actions/setup-go@v3 |
| 27 | + with: |
| 28 | + go-version: ${{ env.GO_VERSION }} |
| 29 | + cache: true |
| 30 | + - name: Build binary artifacts |
| 31 | + run: | |
| 32 | + make build/go MOD=pipedv1 BUILD_OS=linux BUILD_ARCH=amd64 BIN_SUFFIX=_${{ inputs.version }}_linux_amd64 |
| 33 | + make build/go MOD=pipedv1 BUILD_OS=linux BUILD_ARCH=arm64 BIN_SUFFIX=_${{ inputs.version }}_linux_arm64 |
| 34 | + make build/go MOD=pipedv1 BUILD_OS=darwin BUILD_ARCH=amd64 BIN_SUFFIX=_${{ inputs.version }}_darwin_amd64 |
| 35 | + make build/go MOD=pipedv1 BUILD_OS=darwin BUILD_ARCH=arm64 BIN_SUFFIX=_${{ inputs.version }}_darwin_arm64 |
| 36 | +
|
| 37 | + - name: Publish binary artifacts |
| 38 | + uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2.2.1 |
| 39 | + with: |
| 40 | + tag_name: pipedv1/exp/${{ inputs.version }} |
| 41 | + name: pipedv1 experimental ${{ inputs.version }} |
| 42 | + target_commitish: ${{ github.sha }} |
| 43 | + draft: true |
| 44 | + make_latest: "false" |
| 45 | + files: | |
| 46 | + ./.artifacts/pipedv1_${{ inputs.version }}_linux_amd64 |
| 47 | + ./.artifacts/pipedv1_${{ inputs.version }}_linux_arm64 |
| 48 | + ./.artifacts/pipedv1_${{ inputs.version }}_darwin_amd64 |
| 49 | + ./.artifacts/pipedv1_${{ inputs.version }}_darwin_arm64 |
| 50 | +
|
| 51 | + container_image: |
| 52 | + runs-on: ubuntu-24.04 |
| 53 | + permissions: |
| 54 | + contents: read |
| 55 | + packages: write |
| 56 | + strategy: |
| 57 | + matrix: |
| 58 | + container_registry: |
| 59 | + - ghcr.io/pipe-cd |
| 60 | + - gcr.io/pipecd |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 63 | + with: |
| 64 | + fetch-depth: 0 |
| 65 | + |
| 66 | + # Setup QEMU and Buildx. |
| 67 | + - name: Set up QEMU |
| 68 | + uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 |
| 69 | + - name: Set up Docker Buildx |
| 70 | + uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 |
| 71 | + |
| 72 | + # Login to push container images. |
| 73 | + - name: Log in to GHCR |
| 74 | + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 |
| 75 | + with: |
| 76 | + registry: ${{ env.GHCR }} |
| 77 | + username: ${{ github.actor }} |
| 78 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + |
| 80 | + - name: Log in to GCR |
| 81 | + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 |
| 82 | + with: |
| 83 | + registry: ${{ env.GCR }} |
| 84 | + username: _json_key |
| 85 | + password: ${{ secrets.GCR_SA }} |
| 86 | + |
| 87 | + # Building and pushing container images. |
| 88 | + - name: Build and push pipedv1 experimental image |
| 89 | + uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0 |
| 90 | + with: |
| 91 | + push: true |
| 92 | + context: . |
| 93 | + file: cmd/pipedv1/Dockerfile |
| 94 | + tags: ${{ matrix.container_registry }}/pipe-cd/pipedv1-exp:${{ inputs.version }} |
| 95 | + platforms: linux/amd64,linux/arm64 |
| 96 | + # parameter to use inline cache. ref; https://docs.docker.com/build/ci/github-actions/cache/#inline-cache |
| 97 | + cache-from: type=registry,ref=${{ matrix.container_registry }}/pipe-cd/pipedv1-exp:latest |
| 98 | + cache-to: type=inline |
0 commit comments