Skip to content

Commit 3f0fb2f

Browse files
committed
chore(ci): Created new pipeline for pre-release-builds
1 parent 05f47c2 commit 3f0fb2f

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

.github/workflows/build-and-push.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- "v*.*.*"
7+
- "!v*.*.*-pre-release"
78

89
jobs:
910
build:
+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build and Push Pre-release Docker Images
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*-pre-release"
7+
- "!v*.*.*"
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
platform: [amd64, arm64]
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Fetch all history for all branches and tags
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v3
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
- name: Login to Docker Hub
26+
uses: docker/login-action@v3
27+
with:
28+
username: ${{ secrets.DOCKERHUB_USERNAME }}
29+
password: ${{ secrets.DOCKERHUB_TOKEN }}
30+
- name: Set env
31+
run: |
32+
# Extract version from tag (e.g., v1.2.3-pre-release -> 1.2.3)
33+
VERSION=${GITHUB_REF#refs/tags/v}
34+
VERSION=${VERSION%-pre-release}
35+
# Get short SHA
36+
SHA=$(git rev-parse --short HEAD)
37+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
38+
echo "SHA=${SHA}" >> $GITHUB_ENV
39+
- name: Build and push
40+
uses: docker/build-push-action@v6
41+
with:
42+
context: .
43+
push: true
44+
platforms: linux/${{ matrix.platform }}
45+
tags: dagandersen/argocd-diff-preview:${{ env.VERSION }}-${{ env.SHA }}-${{ matrix.platform }}
46+
cache-from: type=gha
47+
cache-to: type=gha,mode=max
48+
49+
create-manifest:
50+
runs-on: ubuntu-latest
51+
needs: [build]
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0 # Fetch all history for all branches and tags
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v3
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v3
61+
- name: Login to Docker Hub
62+
uses: docker/login-action@v3
63+
with:
64+
username: ${{ secrets.DOCKERHUB_USERNAME }}
65+
password: ${{ secrets.DOCKERHUB_TOKEN }}
66+
- name: Set env
67+
run: |
68+
# Extract version from tag (e.g., v1.2.3-pre-release -> 1.2.3)
69+
VERSION=${GITHUB_REF#refs/tags/v}
70+
VERSION=${VERSION%-pre-release}
71+
# Get short SHA
72+
SHA=$(git rev-parse --short HEAD)
73+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
74+
echo "SHA=${SHA}" >> $GITHUB_ENV
75+
- name: create manifest
76+
run: |
77+
docker buildx imagetools create -t \
78+
dagandersen/argocd-diff-preview:${{ env.VERSION }}-${{ env.SHA }} \
79+
dagandersen/argocd-diff-preview:${{ env.VERSION }}-${{ env.SHA }}-amd64 \
80+
dagandersen/argocd-diff-preview:${{ env.VERSION }}-${{ env.SHA }}-arm64

.github/workflows/release.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- "v*.*.*"
7+
- "!v*.*.*-pre-release"
78
env:
89
CRATE_NAME: argocd-diff-preview
910
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)