Add eshop on recipes reference application #972
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build samples | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- edge | |
- v*.* | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: | |
- edge | |
- v*.* | |
concurrency: | |
group: build-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
env: | |
VERSION: ${{ github.event.pull_request.number || 'edge' }} | |
# Use radiusdev.azurecr.io for PR build. Otherwise, use radius.azurecr.io. | |
# TODO_LAUNCH: Remove this env var once we opensource the repo - https://github.com/radius-project/samples/issues/439 | |
DOCKER_REGISTRY: ${{ github.event.pull_request.number && 'radiusdev.azurecr.io' || 'radius.azurecr.io' }} | |
# Use radiusdev.azurecr.io for PR build. Otherwise, use radius.azurecr.io. | |
CONTAINER_REGISTRY: ${{ github.event.pull_request.number && 'ghcr.io/radius-project/dev' || 'ghcr.io/radius-project/samples' }} | |
# Set to true to push images to registry. | |
PUSH_IMAGE: true | |
jobs: | |
# TODO_LAUNCH: Remove this build job once we opensource the repo - https://github.com/radius-project/samples/issues/439 | |
build: | |
name: Build and push sample images to ACR | |
if: github.event.action != 'closed' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Login to container registry | |
uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ env.DOCKER_REGISTRY }} | |
username: '${{ secrets.AZURE_SP_DOCKER_USERNAME }}' | |
password: '${{ secrets.AZURE_SP_DOCKER_PASSWORD }}' | |
- name: demo | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./demo/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.DOCKER_REGISTRY }}/tutorial/demo:${{ env.VERSION }} | |
- name: webapp | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./demo/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.DOCKER_REGISTRY }}/tutorial/webapp:${{ env.VERSION }} | |
- name: dapr-backend | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./quickstarts/dapr/nodeapp/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.DOCKER_REGISTRY }}/quickstarts/dapr-backend:${{ env.VERSION }} | |
- name: dapr-frontend | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./quickstarts/dapr/ui/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.DOCKER_REGISTRY }}/quickstarts/dapr-frontend:${{ env.VERSION }} | |
- name: aws-reference-app | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./reference-apps/aws/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.DOCKER_REGISTRY }}/reference-apps/aws:${{ env.VERSION }} | |
- name: environment-variables | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./quickstarts/environment-variables/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.DOCKER_REGISTRY }}/quickstarts/envvars:${{ env.VERSION }} | |
- name: volumes | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./quickstarts/volumes/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.DOCKER_REGISTRY }}/quickstarts/volumes:${{ env.VERSION }} | |
- name: aws-sqs | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./reference-apps/aws-sqs/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.DOCKER_REGISTRY }}/reference-apps/aws-sqs-sample:${{ env.VERSION }} | |
build-container: | |
name: Build and push sample images to GHCR | |
if: github.event.action != 'closed' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: demo | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./demo/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.CONTAINER_REGISTRY }}/tutorial/demo:${{ env.VERSION }} | |
- name: webapp | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./demo/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.CONTAINER_REGISTRY }}/tutorial/webapp:${{ env.VERSION }} | |
- name: dapr-backend | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./quickstarts/dapr/nodeapp/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.CONTAINER_REGISTRY }}/quickstarts/dapr-backend:${{ env.VERSION }} | |
- name: dapr-frontend | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./quickstarts/dapr/ui/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.CONTAINER_REGISTRY }}/quickstarts/dapr-frontend:${{ env.VERSION }} | |
- name: aws-reference-app | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./reference-apps/aws/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.CONTAINER_REGISTRY }}/reference-apps/aws:${{ env.VERSION }} | |
- name: environment-variables | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./quickstarts/environment-variables/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.CONTAINER_REGISTRY }}/quickstarts/envvars:${{ env.VERSION }} | |
- name: volumes | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./quickstarts/volumes/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.CONTAINER_REGISTRY }}/quickstarts/volumes:${{ env.VERSION }} | |
- name: aws-sqs | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./reference-apps/aws-sqs/ | |
push: ${{ env.PUSH_IMAGE }} | |
tags: ${{ env.CONTAINER_REGISTRY }}/reference-apps/aws-sqs-sample:${{ env.VERSION }} | |
# TODO_LAUNCH: Remove this job once we opensource the repo because all pkgs will be cleaned up regularly - https://github.com/radius-project/samples/issues/439 | |
cleanup: | |
name: Cleanup ${{ matrix.image }} | |
if: github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
image: [ | |
tutorial/webapp, | |
tutorial/demo, | |
quickstarts/dapr-backend, | |
quickstarts/dapr-frontend, | |
quickstarts/envvars, | |
quickstarts/volumes, | |
reference-apps/aws, | |
reference-apps/aws-sqs-sample, | |
] | |
steps: | |
- name: Login to az cli and ACR | |
run: | | |
az login --service-principal --username ${{ secrets.AZURE_SP_DOCKER_USERNAME }} --password ${{ secrets.AZURE_SP_DOCKER_PASSWORD }} --tenant ${{ secrets.AZURE_SP_DOCKER_TENANT }} | |
az acr login --name ${{ env.DOCKER_REGISTRY }} | |
- name: Delete PR images | |
run: az acr repository delete --name ${{ env.DOCKER_REGISTRY }} --image "${{ matrix.image }}:${{ env.VERSION }}" --yes |