Skip to content

Commit a05192e

Browse files
committed
refactor: use docker login action
1 parent df3d793 commit a05192e

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

.github/workflows/publish-image.yaml

+12-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ on:
1414

1515
env:
1616
IMAGE_REGISTRY: ghcr.io
17-
REGISTRY_USER: $GITHUB_ACTOR
1817
API_IMAGE: ghcr.io/equinor/template-fastapi-react/api
1918
NGINX_IMAGE: ghcr.io/equinor/template-fastapi-react/nginx
2019

@@ -26,8 +25,12 @@ jobs:
2625
with:
2726
fetch-depth: 2
2827

29-
- name: "Login to image registry"
30-
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login $IMAGE_REGISTRY -u $GITHUB_ACTOR --password-stdin
28+
- name: "Login to GitHub Container Registry"
29+
uses: docker/login-action@v3
30+
with:
31+
registry: $IMAGE_REGISTRY
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
3134

3235
- name: "Build web"
3336
run: |
@@ -60,8 +63,12 @@ jobs:
6063
with:
6164
fetch-depth: 2
6265

63-
- name: "Login to image registry"
64-
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login $IMAGE_REGISTRY -u $GITHUB_ACTOR --password-stdin
66+
- name: "Login to GitHub Container Registry"
67+
uses: docker/login-action@v3
68+
with:
69+
registry: $IMAGE_REGISTRY
70+
username: ${{ github.actor }}
71+
password: ${{ secrets.GITHUB_TOKEN }}
6572

6673
- name: "Build API"
6774
run: |

.github/workflows/tests.yaml

+12-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111

1212
env:
1313
IMAGE_REGISTRY: ghcr.io
14-
REGISTRY_USER: $GITHUB_ACTOR
1514
API_IMAGE: ghcr.io/equinor/template-fastapi-react/api
1615
WEB_IMAGE: ghcr.io/equinor/template-fastapi-react/web
1716

@@ -42,8 +41,12 @@ jobs:
4241
steps:
4342
- uses: actions/checkout@v4
4443

45-
- name: Login to image registry
46-
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login $IMAGE_REGISTRY -u $GITHUB_ACTOR --password-stdin
44+
- name: "Login to GitHub Container Registry"
45+
uses: docker/login-action@v3
46+
with:
47+
registry: $IMAGE_REGISTRY
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
4750

4851
- name: Build API image
4952
run: |
@@ -62,8 +65,12 @@ jobs:
6265
steps:
6366
- uses: actions/checkout@v4
6467

65-
- name: Login to image registry
66-
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login $IMAGE_REGISTRY -u $GITHUB_ACTOR --password-stdin
68+
- name: "Login to GitHub Container Registry"
69+
uses: docker/login-action@v3
70+
with:
71+
registry: $IMAGE_REGISTRY
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
6774

6875
- name: Build Web Image
6976
run: |

0 commit comments

Comments
 (0)