Skip to content

Commit

Permalink
Merge pull request #55 from Azure-Samples/gh-workflow
Browse files Browse the repository at this point in the history
refactor: gh workflow to publish using gh token
  • Loading branch information
pauldotyu committed Aug 9, 2023
2 parents 79ca1b5 + d6429f6 commit b029ebe
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 14 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/package-ai-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
publish-container-image:

Expand All @@ -18,7 +22,7 @@ jobs:
- name: Set environment variables
id: set-variables
run: |
echo "REPOSITORY=ghcr.io/azure-samples/aks-store-demo" >> "$GITHUB_OUTPUT"
echo "REPOSITORY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
echo "IMAGE=ai-service" >> "$GITHUB_OUTPUT"
echo "VERSION=$(echo ${GITHUB_SHA} | cut -c1-7)" >> "$GITHUB_OUTPUT"
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
Expand All @@ -42,7 +46,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
password: ${{ github.token }}

- name: Build and push
uses: docker/build-push-action@v2
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/package-makeline-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
publish-container-image:

Expand All @@ -18,7 +22,7 @@ jobs:
- name: Set environment variables
id: set-variables
run: |
echo "REPOSITORY=ghcr.io/azure-samples/aks-store-demo" >> "$GITHUB_OUTPUT"
echo "REPOSITORY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
echo "IMAGE=makeline-service" >> "$GITHUB_OUTPUT"
echo "VERSION=$(echo ${GITHUB_SHA} | cut -c1-7)" >> "$GITHUB_OUTPUT"
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
Expand All @@ -42,7 +46,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
password: ${{ github.token }}

- name: Build and push
uses: docker/build-push-action@v2
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/package-order-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
publish-container-image:

Expand All @@ -18,7 +22,7 @@ jobs:
- name: Set environment variables
id: set-variables
run: |
echo "REPOSITORY=ghcr.io/azure-samples/aks-store-demo" >> "$GITHUB_OUTPUT"
echo "REPOSITORY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
echo "IMAGE=order-service" >> "$GITHUB_OUTPUT"
echo "VERSION=$(echo ${GITHUB_SHA} | cut -c1-7)" >> "$GITHUB_OUTPUT"
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
Expand All @@ -42,7 +46,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
password: ${{ github.token }}

- name: Build and push
uses: docker/build-push-action@v2
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/package-product-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
publish-container-image:

Expand All @@ -18,7 +22,7 @@ jobs:
- name: Set environment variables
id: set-variables
run: |
echo "REPOSITORY=ghcr.io/azure-samples/aks-store-demo" >> "$GITHUB_OUTPUT"
echo "REPOSITORY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
echo "IMAGE=product-service" >> "$GITHUB_OUTPUT"
echo "VERSION=$(echo ${GITHUB_SHA} | cut -c1-7)" >> "$GITHUB_OUTPUT"
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
Expand All @@ -42,7 +46,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
password: ${{ github.token }}

- name: Build and push
uses: docker/build-push-action@v2
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/package-store-admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
publish-container-image:

Expand All @@ -18,7 +22,7 @@ jobs:
- name: Set environment variables
id: set-variables
run: |
echo "REPOSITORY=ghcr.io/azure-samples/aks-store-demo" >> "$GITHUB_OUTPUT"
echo "REPOSITORY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
echo "IMAGE=store-admin" >> "$GITHUB_OUTPUT"
echo "VERSION=$(echo ${GITHUB_SHA} | cut -c1-7)" >> "$GITHUB_OUTPUT"
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
Expand All @@ -42,7 +46,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
password: ${{ github.token }}

- name: Build and push
uses: docker/build-push-action@v2
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/package-store-front.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
publish-container-image:

Expand All @@ -18,7 +22,7 @@ jobs:
- name: Set environment variables
id: set-variables
run: |
echo "REPOSITORY=ghcr.io/azure-samples/aks-store-demo" >> "$GITHUB_OUTPUT"
echo "REPOSITORY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
echo "IMAGE=store-front" >> "$GITHUB_OUTPUT"
echo "VERSION=$(echo ${GITHUB_SHA} | cut -c1-7)" >> "$GITHUB_OUTPUT"
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
Expand All @@ -42,7 +46,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
password: ${{ github.token }}

- name: Build and push
uses: docker/build-push-action@v2
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/package-virtual-customer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
publish-container-image:

Expand All @@ -18,7 +22,7 @@ jobs:
- name: Set environment variables
id: set-variables
run: |
echo "REPOSITORY=ghcr.io/azure-samples/aks-store-demo" >> "$GITHUB_OUTPUT"
echo "REPOSITORY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
echo "IMAGE=virtual-customer" >> "$GITHUB_OUTPUT"
echo "VERSION=$(echo ${GITHUB_SHA} | cut -c1-7)" >> "$GITHUB_OUTPUT"
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
Expand All @@ -42,7 +46,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
password: ${{ github.token }}

- name: Build and push
uses: docker/build-push-action@v2
Expand Down

0 comments on commit b029ebe

Please sign in to comment.