Skip to content

[refactor] simplify Page Authorization based on MobX RESTful persistence #85

[refactor] simplify Page Authorization based on MobX RESTful persistence

[refactor] simplify Page Authorization based on MobX RESTful persistence #85

Workflow file for this run

# 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:
tags:
- v*
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: read
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: openhackathon/oph-web,kysprodacr.azurecr.cn/oph-web
# add Git short SHA as Docker tag
tags: |
type=sha
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESSTOKEN }}
- name: Login to Azure Container Registry
uses: docker/login-action@v3
with:
registry: kysprodacr.azurecr.cn
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Inject Environment variables
run: |
cat >> .npmrc <<EOF
//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}
@kaiyuanshe:registry=https://npm.pkg.github.com
always-auth=true
EOF
cat > .env.local <<EOF
${{ secrets.ENV_FILE }}
VERCEL_PROJECT_PRODUCTION_URL=hackathon.kaiyuanshe.cn
EOF
- name: Build and Push image
uses: docker/build-push-action@v6
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 }}'