Skip to content

Commit

Permalink
Update actions: Use token based authentication (#1111)
Browse files Browse the repository at this point in the history
  • Loading branch information
samruddhikhandale authored Jul 8, 2024
1 parent bbc237b commit a40cd7f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 36 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/push-again.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
name: Build and push images
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
environment: publishing
steps:
- name: Free more space
id: free_space
Expand All @@ -39,12 +40,6 @@ jobs:
with:
path: 'release'
ref: ${{ github.event.inputs.release }}

- name: Azure CLI login
id: az_login
uses: azure/login@v1
with:
creds: ${{ secrets.AZ_ACR_CREDS }}

- name: Build and push
id: build_and_push
Expand All @@ -54,12 +49,14 @@ jobs:
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
PASSWORD: ${{ secrets.PASSWORD }}
run: |
set -e
# ACR login
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
az acr login --name $ACR_REGISTRY_NAME
az acr login --name $ACR_REGISTRY_NAME --username $TOKEN_NAME --password $PASSWORD
# Setup build CLI
cd "$GITHUB_WORKSPACE/ref"
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/push-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
page-total: [70]
fail-fast: false
runs-on: devcontainer-image-builder-ubuntu
environment: publishing
steps:
- name: Free more space
id: free_space
Expand All @@ -29,12 +30,6 @@ jobs:
id: checkout
uses: actions/checkout@v3

- name: Azure CLI login
id: az_login
uses: azure/login@v1
with:
creds: ${{ secrets.AZ_ACR_CREDS }}

- name: Build and push dev tags
id: build_and_push
env:
Expand All @@ -44,12 +39,14 @@ jobs:
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
PASSWORD: ${{ secrets.PASSWORD }}
run: |
set -e
# ACR login
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
az acr login --name $ACR_REGISTRY_NAME
az acr login --name $ACR_REGISTRY_NAME --username $TOKEN_NAME --password $PASSWORD
# Build and push dev images
yarn install
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/push-manual-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
name: Build and push images
if: ${{ startsWith(github.ref, 'refs/heads/') }}
runs-on: devcontainer-image-builder-ubuntu
environment: publishing
steps:
- name: Free more space
id: free_space
Expand All @@ -35,12 +36,6 @@ jobs:
with:
path: 'release'
ref: ${{ github.event.inputs.release }}

- name: Azure CLI login
id: az_login
uses: azure/login@v1
with:
creds: ${{ secrets.AZ_ACR_CREDS }}

- name: Build and push
id: build_and_push
Expand All @@ -50,12 +45,14 @@ jobs:
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
PASSWORD: ${{ secrets.PASSWORD }}
run: |
set -e
# ACR login
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
az acr login --name $ACR_REGISTRY_NAME
az acr login --name $ACR_REGISTRY_NAME --username $TOKEN_NAME --password $PASSWORD
# Setup build CLI
cd "$GITHUB_WORKSPACE/ref"
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
page-total: [70]
fail-fast: false
runs-on: devcontainer-image-builder-ubuntu
environment: publishing
steps:
- name: Free more space
id: free_space
Expand All @@ -33,12 +34,6 @@ jobs:
id: get_tag_name
run: echo "::set-output name=tag::$(echo "${{ github.ref }}" | grep -oP 'refs/tags/\K(.+)')"

- name: Azure CLI login
id: az_login
uses: azure/login@v1
with:
creds: ${{ secrets.AZ_ACR_CREDS }}

- name: Build and push
id: build_and_push
env:
Expand All @@ -48,12 +43,14 @@ jobs:
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
PASSWORD: ${{ secrets.PASSWORD }}
run: |
set -e
# ACR login
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
az acr login --name $ACR_REGISTRY_NAME
az acr login --name $ACR_REGISTRY_NAME --username $TOKEN_NAME --password $PASSWORD
# Build and push images
yarn install
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/version-history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
name: Update version history
if: ${{ github.ref == 'refs/heads/main' || github.event.base_ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
environment: documentation
environment: publishing
permissions:
contents: write
pull-requests: write
Expand All @@ -48,25 +48,21 @@ jobs:
id: checkout
uses: actions/checkout@v3

- name: Azure CLI login
id: az_login
uses: azure/login@v1
with:
creds: ${{ secrets.AZ_ACR_CREDS }}

- name: Get image info
id: Get_image_info
env:
REGISTRY: ${{ secrets.REGISTRY }}
REGISTRY_BASE_PATH: ${{ secrets.REGISTRY_BASE_PATH }}
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
PASSWORD: ${{ secrets.PASSWORD }}
run: |
set -e
# ACR login
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
az acr login --name $ACR_REGISTRY_NAME
az acr login --name $ACR_REGISTRY_NAME --username $TOKEN_NAME --password $PASSWORD
yarn install
RELEASE_STRING=$(echo "${{ inputs.release }}" | grep -oP 'refs/(heads|tags)/\K(.+)')
Expand Down

0 comments on commit a40cd7f

Please sign in to comment.