[add] GitHub repository & issue configuration #73
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
# This is a basic workflow to help you get started with Actions | |
name: Docker Build, Push and Publish | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: | |
- main | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Docker meta | |
id: docker_meta | |
uses: crazy-max/ghaction-docker-meta@v1 | |
with: | |
images: openhackathon/oph-web,kysprodacr.azurecr.cn/oph-web # list of Docker images to use as base name for tags | |
tag-sha: true # add git short SHA as Docker tag | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ACCESSTOKEN }} | |
- name: Login to Azure Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: kysprodacr.azurecr.cn | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Inject Environment variables | |
run: | | |
cat > .env.local <<EOF | |
${{ secrets.ENV_FILE }} | |
EOF | |
- name: Build and Push image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
- uses: benjlevesque/[email protected] | |
id: short-sha | |
with: | |
length: 7 | |
- uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ secrets.AZURE_WEBAPP_NAME }} | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
images: 'kysprodacr.azurecr.cn/oph-web:sha-${{ steps.short-sha.outputs.sha }}' |