Skip to content

Commit 45f5481

Browse files
committed
Update github actions
1 parent 5fdb8a8 commit 45f5481

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

.github/workflows/docker-main.yml

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Deploy
1+
name: Build Docker Image
22

33
on:
44
workflow_dispatch:
@@ -12,42 +12,41 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616

1717
- name: Prepare Tags
1818
id: prep
1919
run: |
2020
DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPOSITORY#*/}
21-
VERSION=latest
2221
23-
# If this is git tag, use the tag name as a docker tag
24-
if [[ $GITHUB_REF == refs/tags/* ]]; then
25-
VERSION=${GITHUB_REF#refs/tags/}
22+
VERSION=${GITHUB_REF##*/}
23+
24+
# If this is the main branch, use 'latest' instead
25+
if [[ $GITHUB_REF == refs/heads/main ]]; then
26+
VERSION=latest
2627
fi
28+
2729
TAGS="${DOCKER_IMAGE}:${VERSION}"
2830
29-
# If the VERSION looks like a version number, assume that
30-
# this is the most recent version of the image and also
31-
# tag it 'latest'.
32-
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
31+
# If the version is a version number, also tag with 'latest'
32+
if [[ $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
3333
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
3434
fi
3535
3636
# Tag with the GitHub run id to create a unique tag for this run
3737
TAGS="$TAGS,${DOCKER_IMAGE}:${GITHUB_RUN_ID}"
3838
39-
# Set output parameters.
40-
echo ::set-output name=tags::${TAGS}
41-
echo ::set-output name=docker_image::${DOCKER_IMAGE}
39+
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
40+
echo "docker_image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT
4241
4342
- name: Set up QEMU
44-
uses: docker/setup-qemu-action@master
43+
uses: docker/setup-qemu-action@v2
4544
with:
4645
platforms: all
4746

4847
- name: Set up Docker Buildx
4948
id: buildx
50-
uses: docker/setup-buildx-action@master
49+
uses: docker/setup-buildx-action@v2
5150

5251
- name: Login to Docker
5352
if: github.event_name != 'pull_request'

0 commit comments

Comments
 (0)