Skip to content

Commit 1afdc84

Browse files
authored
build: reset pr pipeline docker tag (#68)
1 parent 56e0fec commit 1afdc84

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

.github/workflows/pr-pipeline.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ jobs:
4343
- name: Check out code
4444
uses: actions/checkout@v4
4545

46-
- name: Read version from file
47-
id: get_version
46+
- name: Setup envs
47+
id: setup_envs
4848
run: |
49-
ls -la
50-
echo "VERSION=$(cat version)" >> $GITHUB_ENV
49+
VERSION=$(git tag --merged $BRANCH_NAME --sort=-v:refname | head -n 1)
50+
if [ -z "$VERSION" ]; then
51+
VERSION="3.18.0"
52+
fi
53+
echo "VERSION=$VERSION" >> $GITHUB_ENV
5154
52-
- name: Get branch name
53-
id: get_branch
54-
run: |
5555
if [ "${{ github.event_name }}" == "pull_request" ]; then
5656
BRANCH_NAME=${{ github.head_ref }}
5757
else
@@ -61,9 +61,9 @@ jobs:
6161
SANITIZED_BRANCH_NAME=$(echo "$BRANCH_NAME" | tr -cs '[:alnum:]' '-' | sed 's/-*$//' | tr '[:upper:]' '[:lower:]')
6262
echo "BRANCH_NAME=$SANITIZED_BRANCH_NAME" >> $GITHUB_ENV
6363
64-
- name: Get short commit SHA
65-
id: get_commit
66-
run: echo "COMMIT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
64+
echo "TIMESTAMP=$(date -u +'%y%m%d%H%M')" >> $GITHUB_ENV
65+
66+
echo "COMMIT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
6767
6868
- name: Set up QEMU
6969
uses: docker/setup-qemu-action@v3
@@ -87,6 +87,6 @@ jobs:
8787
file: ./build/Dockerfile
8888
context: .
8989
push: true
90-
tags: ghcr.io/${{ github.repository }}:${{ env.VERSION }}-${{ env.BRANCH_NAME }}-${{ env.COMMIT_SHA }}
90+
tags: ghcr.io/${{ github.repository }}:${{ env.VERSION }}-${{ env.BRANCH_NAME }}-${{ env.TIMESTAMP }}.${{ env.COMMIT_SHA }}
9191
platforms: linux/amd64,linux/arm64
9292

build/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ FROM $BUILDER_IMAGE AS builder
1717
WORKDIR /workspace
1818

1919
# Copy the go source
20-
COPY version version
2120
COPY api/ api/
2221
COPY cmd/ cmd/
2322
COPY internal/ internal/

version

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)