Skip to content

Commit a40cd7f

Browse files
Update actions: Use token based authentication (devcontainers#1111)
1 parent bbc237b commit a40cd7f

File tree

5 files changed

+20
-36
lines changed

5 files changed

+20
-36
lines changed

.github/workflows/push-again.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
name: Build and push images
1717
if: ${{ github.ref == 'refs/heads/main' }}
1818
runs-on: ubuntu-latest
19+
environment: publishing
1920
steps:
2021
- name: Free more space
2122
id: free_space
@@ -39,12 +40,6 @@ jobs:
3940
with:
4041
path: 'release'
4142
ref: ${{ github.event.inputs.release }}
42-
43-
- name: Azure CLI login
44-
id: az_login
45-
uses: azure/login@v1
46-
with:
47-
creds: ${{ secrets.AZ_ACR_CREDS }}
4843

4944
- name: Build and push
5045
id: build_and_push
@@ -54,12 +49,14 @@ jobs:
5449
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
5550
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
5651
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
52+
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
53+
PASSWORD: ${{ secrets.PASSWORD }}
5754
run: |
5855
set -e
5956
6057
# ACR login
6158
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
62-
az acr login --name $ACR_REGISTRY_NAME
59+
az acr login --name $ACR_REGISTRY_NAME --username $TOKEN_NAME --password $PASSWORD
6360
6461
# Setup build CLI
6562
cd "$GITHUB_WORKSPACE/ref"

.github/workflows/push-dev.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
page-total: [70]
1616
fail-fast: false
1717
runs-on: devcontainer-image-builder-ubuntu
18+
environment: publishing
1819
steps:
1920
- name: Free more space
2021
id: free_space
@@ -29,12 +30,6 @@ jobs:
2930
id: checkout
3031
uses: actions/checkout@v3
3132

32-
- name: Azure CLI login
33-
id: az_login
34-
uses: azure/login@v1
35-
with:
36-
creds: ${{ secrets.AZ_ACR_CREDS }}
37-
3833
- name: Build and push dev tags
3934
id: build_and_push
4035
env:
@@ -44,12 +39,14 @@ jobs:
4439
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
4540
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
4641
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
42+
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
43+
PASSWORD: ${{ secrets.PASSWORD }}
4744
run: |
4845
set -e
4946
5047
# ACR login
5148
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
52-
az acr login --name $ACR_REGISTRY_NAME
49+
az acr login --name $ACR_REGISTRY_NAME --username $TOKEN_NAME --password $PASSWORD
5350
5451
# Build and push dev images
5552
yarn install

.github/workflows/push-manual-dev.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
name: Build and push images
1313
if: ${{ startsWith(github.ref, 'refs/heads/') }}
1414
runs-on: devcontainer-image-builder-ubuntu
15+
environment: publishing
1516
steps:
1617
- name: Free more space
1718
id: free_space
@@ -35,12 +36,6 @@ jobs:
3536
with:
3637
path: 'release'
3738
ref: ${{ github.event.inputs.release }}
38-
39-
- name: Azure CLI login
40-
id: az_login
41-
uses: azure/login@v1
42-
with:
43-
creds: ${{ secrets.AZ_ACR_CREDS }}
4439

4540
- name: Build and push
4641
id: build_and_push
@@ -50,12 +45,14 @@ jobs:
5045
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
5146
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
5247
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
48+
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
49+
PASSWORD: ${{ secrets.PASSWORD }}
5350
run: |
5451
set -e
5552
5653
# ACR login
5754
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
58-
az acr login --name $ACR_REGISTRY_NAME
55+
az acr login --name $ACR_REGISTRY_NAME --username $TOKEN_NAME --password $PASSWORD
5956
6057
# Setup build CLI
6158
cd "$GITHUB_WORKSPACE/ref"

.github/workflows/push.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
page-total: [70]
1616
fail-fast: false
1717
runs-on: devcontainer-image-builder-ubuntu
18+
environment: publishing
1819
steps:
1920
- name: Free more space
2021
id: free_space
@@ -33,12 +34,6 @@ jobs:
3334
id: get_tag_name
3435
run: echo "::set-output name=tag::$(echo "${{ github.ref }}" | grep -oP 'refs/tags/\K(.+)')"
3536

36-
- name: Azure CLI login
37-
id: az_login
38-
uses: azure/login@v1
39-
with:
40-
creds: ${{ secrets.AZ_ACR_CREDS }}
41-
4237
- name: Build and push
4338
id: build_and_push
4439
env:
@@ -48,12 +43,14 @@ jobs:
4843
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
4944
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
5045
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
46+
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
47+
PASSWORD: ${{ secrets.PASSWORD }}
5148
run: |
5249
set -e
5350
5451
# ACR login
5552
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
56-
az acr login --name $ACR_REGISTRY_NAME
53+
az acr login --name $ACR_REGISTRY_NAME --username $TOKEN_NAME --password $PASSWORD
5754
5855
# Build and push images
5956
yarn install

.github/workflows/version-history.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
name: Update version history
3030
if: ${{ github.ref == 'refs/heads/main' || github.event.base_ref == 'refs/heads/main' }}
3131
runs-on: ubuntu-latest
32-
environment: documentation
32+
environment: publishing
3333
permissions:
3434
contents: write
3535
pull-requests: write
@@ -48,25 +48,21 @@ jobs:
4848
id: checkout
4949
uses: actions/checkout@v3
5050

51-
- name: Azure CLI login
52-
id: az_login
53-
uses: azure/login@v1
54-
with:
55-
creds: ${{ secrets.AZ_ACR_CREDS }}
56-
5751
- name: Get image info
5852
id: Get_image_info
5953
env:
6054
REGISTRY: ${{ secrets.REGISTRY }}
6155
REGISTRY_BASE_PATH: ${{ secrets.REGISTRY_BASE_PATH }}
6256
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
6357
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
58+
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
59+
PASSWORD: ${{ secrets.PASSWORD }}
6460
run: |
6561
set -e
6662
6763
# ACR login
6864
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
69-
az acr login --name $ACR_REGISTRY_NAME
65+
az acr login --name $ACR_REGISTRY_NAME --username $TOKEN_NAME --password $PASSWORD
7066
7167
yarn install
7268
RELEASE_STRING=$(echo "${{ inputs.release }}" | grep -oP 'refs/(heads|tags)/\K(.+)')

0 commit comments

Comments
 (0)