Skip to content

Commit 62eb042

Browse files
authored
Update Docker workflow for private image publishing
1 parent 399c861 commit 62eb042

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed
Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
1-
name: Docker Private
1+
name: Publish Docker Private Image
2+
23
on:
3-
[workflow_dispatch]
4+
push:
5+
branches:
6+
- TSDB_dev
7+
workflow_dispatch:
48

59
jobs:
6-
push:
7-
10+
build-and-push:
811
runs-on: ubuntu-latest
912

1013
steps:
11-
- uses: actions/checkout@v4
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Prepare Docker Metadata
18+
id: prep
19+
run: |
20+
REPO_LC=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')
21+
echo "repo=${REPO_LC}" >> $GITHUB_OUTPUT
22+
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
1223
13-
- name: Get current date for tag
14-
id: date
15-
run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
24+
- name: Log in to Docker Hub
25+
uses: docker/login-action@v3
26+
with:
27+
username: ${{ secrets.DOCKER_USERNAME }}
28+
password: ${{ secrets.DOCKER_TOKEN }}
1629

17-
- name: Log into registry
18-
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }}
19-
2030
- name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v3
22-
31+
uses: docker/setup-buildx-action@v3
32+
2333
- name: Build and push Docker image
2434
uses: docker/build-push-action@v6
2535
with:
2636
context: .
2737
push: true
38+
# This builds once and applies both tags to a single image
2839
tags: |
29-
buxtoncalvin/ppg:latest
30-
buxtoncalvin/ppg:${{ steps.date.outputs.NOW }}
40+
${{ secrets.DOCKER_USERNAME }}/ppg:latest
41+
${{ secrets.DOCKER_USERNAME }}/ppg:${{ steps.prep.outputs.date }}
42+

0 commit comments

Comments
 (0)