Skip to content

Commit 08b80c3

Browse files
Update docker-build.yml
1 parent f09db5e commit 08b80c3

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

.github/workflows/docker-build.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
name: Build and Push Docker Images
2-
32
on:
43
schedule:
5-
- cron: '0 0 1 * *' # Run monthly on the 1st
4+
- cron: '0 0 1 *'* # Run monthly on the 1st
65
workflow_dispatch: # Allow manual triggers
7-
86
env:
97
REGISTRY: ghcr.io
108
IMAGE_NAME: ${{ github.repository }}
11-
9+
TAG_DATE: ${{ format('{0}{1}{2}', github.event.repository.pushed_at.substring(0,4), github.event.repository.pushed_at.substring(5,7), github.event.repository.pushed_at.substring(8,10)) }}
1210
jobs:
1311
build-and-push:
1412
runs-on: ubuntu-latest
1513
permissions:
1614
contents: read
1715
packages: write
18-
1916
steps:
2017
- name: Checkout repository
2118
uses: actions/checkout@v4
19+
20+
- name: Set current date
21+
id: date
22+
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
2223

2324
- name: Log in to the Container registry
2425
uses: docker/login-action@v3
@@ -34,7 +35,7 @@ jobs:
3435
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3536
tags: |
3637
type=raw,value=latest
37-
type=raw,value={{date 'YYYYMMDD'}}
38+
type=raw,value=${{ env.DATE }}
3839
3940
- name: Build and push regular image
4041
uses: docker/build-push-action@v5
@@ -53,5 +54,5 @@ jobs:
5354
push: true
5455
tags: |
5556
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine
56-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-${TAG_DATE}
57-
labels: ${{ steps.meta.outputs.labels }}
57+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-${{ env.DATE }}
58+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)