Skip to content

Commit a03cfc9

Browse files
committed
feat(ci): add dev branch build and push
1 parent d44671a commit a03cfc9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
release:
1414
types: [published]
1515

16+
push:
17+
branches:
18+
- dev
19+
1620
jobs:
1721
build-and-push:
1822
runs-on: ubuntu-latest
@@ -60,14 +64,16 @@ jobs:
6064
if [ "${{ github.event_name }}" == "release" ]; then
6165
CONTAINER_VERSION="${{ github.event.release.tag_name }}"
6266
CONTAINER_VERSION="${CONTAINER_VERSION#v}"
63-
6467
IS_PRERELEASE="${{ github.event.release.prerelease }}"
68+
elif [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/dev" ]; then
69+
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
70+
CONTAINER_VERSION="dev-${SHORT_SHA}"
71+
IS_PRERELEASE="true"
6572
elif [ "${{ github.event_name }}" == "pull_request" ]; then
6673
CONTAINER_VERSION="pr-${{ github.event.pull_request.number }}"
6774
IS_PRERELEASE="true"
6875
else
6976
CONTAINER_VERSION="${{ github.event.inputs.container_version }}"
70-
7177
CONTAINER_VERSION="${CONTAINER_VERSION#v}"
7278
7379
if [[ "$CONTAINER_VERSION" == *"-beta"* ]]; then
@@ -97,11 +103,11 @@ jobs:
97103
98104
TAGS="$DOCKERHUB_REPO:$CONTAINER_VERSION,$GHCR_REPO:$CONTAINER_VERSION"
99105
100-
101-
if [ "$IS_PRERELEASE" == "true" ]; then
106+
if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/dev" ]; then
107+
TAGS="$TAGS,$DOCKERHUB_REPO:dev,$GHCR_REPO:dev"
108+
elif [ "$IS_PRERELEASE" == "true" ]; then
102109
TAGS="$TAGS,$DOCKERHUB_REPO:beta,$GHCR_REPO:beta"
103110
else
104-
105111
if [[ "$CONTAINER_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
106112
MAJOR="${BASH_REMATCH[1]}"
107113
MINOR="${BASH_REMATCH[2]}"

0 commit comments

Comments
 (0)