Skip to content

Commit 566595a

Browse files
committed
Use docker login action
1 parent 7e90c39 commit 566595a

File tree

3 files changed

+54
-22
lines changed

3 files changed

+54
-22
lines changed

.github/workflows/debian.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ jobs:
3030
- name: Checkout repository
3131
uses: actions/checkout@v4
3232
- name: Login to GitHub Registry
33-
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login ${CONTAINER_REGISTRY} -u '${{ github.repository_owner }}' --password-stdin
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.CONTAINER_REGISTRY }}
36+
username: ${{ github.repository_owner }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
3438
- name: Determine the Docker image name.
3539
run: |
3640
# Convert the repository name to lowercase as the organization name is
3741
# uppercase, which is not permitted by the Docker registry.
38-
REPO=${{ github.repository }}
39-
CONTAINER_REPOSITORY=${REPO@L}
42+
GITHUB_REPO=${{ github.repository }}
43+
CONTAINER_REPOSITORY=${GITHUB_REPO@L}
4044
echo "CONTAINER_IMAGE=${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/debian-${{ matrix.version.os }}:gcc${{ matrix.version.gcc }}" >> $GITHUB_ENV
4145
- name: Build the Docker image
4246
working-directory: docker/debian
@@ -73,14 +77,18 @@ jobs:
7377
steps:
7478
- name: Checkout repository
7579
uses: actions/checkout@v4
76-
- name: Login to GitHub Container Registry
77-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${CONTAINER_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
80+
- name: Login to GitHub Registry
81+
uses: docker/login-action@v3
82+
with:
83+
registry: ${{ env.CONTAINER_REGISTRY }}
84+
username: ${{ github.repository_owner }}
85+
password: ${{ secrets.GITHUB_TOKEN }}
7886
- name: Determine the Docker image name.
7987
run: |
8088
# Convert the repository name to lowercase as the organization name is
8189
# uppercase, which is not permitted by the Docker registry.
82-
REPO=${{ github.repository }}
83-
CONTAINER_REPOSITORY=${REPO@L}
90+
GITHUB_REPO=${{ github.repository }}
91+
CONTAINER_REPOSITORY=${GITHUB_REPO@L}
8492
echo "CONTAINER_IMAGE=${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/debian-${{ matrix.version.os }}:clang${{ matrix.version.clang }}" >> $GITHUB_ENV
8593
- name: Build the Docker image
8694
working-directory: docker/debian

.github/workflows/rhel.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,23 @@ jobs:
3030
- name: Checkout repository
3131
uses: actions/checkout@v4
3232
- name: Login to GitHub Registry
33-
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login ${CONTAINER_REGISTRY} -u '${{ github.repository_owner }}' --password-stdin
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.CONTAINER_REGISTRY }}
36+
username: ${{ github.repository_owner }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
3438
- name: Login to Red Hat Registry
35-
run: echo '${{ secrets.REDHAT_TOKEN }}' | docker login ${REDHAT_REGISTRY} -u '${{ secrets.REDHAT_USER }}' --password-stdin
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ${{ env.REDHAT_REGISTRY }}
42+
username: ${{ secrets.REDHAT_USER }}
43+
password: ${{ secrets.REDHAT_TOKEN }}
3644
- name: Determine the Docker image name.
3745
run: |
3846
# Convert the repository name to lowercase as the organization name is
3947
# uppercase, which is not permitted by the Docker registry.
40-
REPO=${{ github.repository }}
41-
CONTAINER_REPOSITORY=${REPO@L}
48+
GITHUB_REPO=${{ github.repository }}
49+
CONTAINER_REPOSITORY=${GITHUB_REPO@L}
4250
echo "CONTAINER_IMAGE=${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/rhel-${{ matrix.version.os }}:gcc${{ matrix.version.gcc }}" >> $GITHUB_ENV
4351
- name: Build the Docker image
4452
working-directory: docker/rhel
@@ -69,15 +77,23 @@ jobs:
6977
- name: Checkout repository
7078
uses: actions/checkout@v4
7179
- name: Login to GitHub Registry
72-
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login ${CONTAINER_REGISTRY} -u '${{ github.repository_owner }}' --password-stdin
80+
uses: docker/login-action@v3
81+
with:
82+
registry: ${{ env.CONTAINER_REGISTRY }}
83+
username: ${{ github.repository_owner }}
84+
password: ${{ secrets.GITHUB_TOKEN }}
7385
- name: Login to Red Hat Registry
74-
run: echo '${{ secrets.REDHAT_TOKEN }}' | docker login ${REDHAT_REGISTRY} -u '${{ secrets.REDHAT_USER }}' --password-stdin
86+
uses: docker/login-action@v3
87+
with:
88+
registry: ${{ env.REDHAT_REGISTRY }}
89+
username: ${{ secrets.REDHAT_USER }}
90+
password: ${{ secrets.REDHAT_TOKEN }}
7591
- name: Determine the Docker image name.
7692
run: |
7793
# Convert the repository name to lowercase as the organization name is
7894
# uppercase, which is not permitted by the Docker registry.
79-
REPO=${{ github.repository }}
80-
CONTAINER_REPOSITORY=${REPO@L}
95+
GITHUB_REPO=${{ github.repository }}
96+
CONTAINER_REPOSITORY=${GITHUB_REPO@L}
8197
echo "CONTAINER_IMAGE=${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/rhel-${{ matrix.version.os }}:clang" >> $GITHUB_ENV
8298
- name: Build the Docker image
8399
working-directory: docker/rhel

.github/workflows/ubuntu.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@ jobs:
3131
- name: Checkout repository
3232
uses: actions/checkout@v4
3333
- name: Login to GitHub Registry
34-
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login ${CONTAINER_REGISTRY} -u '${{ github.repository_owner }}' --password-stdin
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ env.CONTAINER_REGISTRY }}
37+
username: ${{ github.repository_owner }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
3539
- name: Determine the Docker image name.
3640
run: |
3741
# Convert the repository name to lowercase as the organization name is
3842
# uppercase, which is not permitted by the Docker registry.
39-
REPO=${{ github.repository }}
40-
CONTAINER_REPOSITORY=${REPO@L}
43+
GITHUB_REPO=${{ github.repository }}
44+
CONTAINER_REPOSITORY=${GITHUB_REPO@L}
4145
echo "CONTAINER_IMAGE=${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/ubuntu-${{ matrix.version.os }}:gcc${{ matrix.version.gcc }}" >> $GITHUB_ENV
4246
- name: Build the Docker image
4347
working-directory: docker/ubuntu
@@ -73,14 +77,18 @@ jobs:
7377
steps:
7478
- name: Checkout repository
7579
uses: actions/checkout@v4
76-
- name: Login to GitHub Container Registry
77-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${CONTAINER_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
80+
- name: Login to GitHub Registry
81+
uses: docker/login-action@v3
82+
with:
83+
registry: ${{ env.CONTAINER_REGISTRY }}
84+
username: ${{ github.repository_owner }}
85+
password: ${{ secrets.GITHUB_TOKEN }}
7886
- name: Determine the Docker image name.
7987
run: |
8088
# Convert the repository name to lowercase as the organization name is
8189
# uppercase, which is not permitted by the Docker registry.
82-
REPO=${{ github.repository }}
83-
CONTAINER_REPOSITORY=${REPO@L}
90+
GITHUB_REPO=${{ github.repository }}
91+
CONTAINER_REPOSITORY=${GITHUB_REPO@L}
8492
echo "CONTAINER_IMAGE=${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/ubuntu-${{ matrix.version.os }}:clang${{ matrix.version.clang }}" >> $GITHUB_ENV
8593
- name: Build the Docker image
8694
working-directory: docker/ubuntu

0 commit comments

Comments
 (0)