Skip to content

Commit 02cb7bf

Browse files
authored
ci: build and publish container image in release workflow (#607)
1 parent fbf5700 commit 02cb7bf

2 files changed

Lines changed: 41 additions & 64 deletions

File tree

.github/workflows/container.yaml

Lines changed: 0 additions & 64 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
permissions:
1010
contents: write
11+
packages: write
1112

1213
jobs:
1314
goreleaser:
@@ -34,6 +35,46 @@ jobs:
3435
args: release --clean --verbose -f goreleaser.yaml ${{ env.flags }}
3536
env:
3637
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Set up QEMU
39+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
40+
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
41+
- name: Set up Docker Buildx
42+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
43+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
44+
- name: Log in to GitHub Container Registry
45+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
46+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
47+
with:
48+
registry: ghcr.io
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
- name: Docker metadata
52+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
53+
id: meta
54+
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
55+
with:
56+
images: ghcr.io/${{ github.repository }}
57+
tags: |
58+
type=semver,pattern={{version}}
59+
type=semver,pattern={{major}}.{{minor}}
60+
type=raw,value=latest
61+
- name: Prepare binaries for container image
62+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
63+
env:
64+
VERSION: ${{ github.ref_name }}
65+
run: |
66+
cp "dist/pipeleek_${VERSION}_linux_amd64" pipeleek_amd64
67+
cp "dist/pipeleek_${VERSION}_linux_arm64" pipeleek_arm64
68+
chmod +x pipeleek_amd64 pipeleek_arm64
69+
- name: Build and push container image
70+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
71+
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
72+
with:
73+
context: .
74+
platforms: linux/amd64,linux/arm64
75+
push: true
76+
tags: ${{ steps.meta.outputs.tags }}
77+
labels: ${{ steps.meta.outputs.labels }}
3778
- name: Upload assets
3879
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3980
with:

0 commit comments

Comments
 (0)