feat: add frontend dashboard endpoint & placeholder data #26
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-app: | |
name: 'Build and push app container' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for the build | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=sha,prefix=git- | |
labels: | | |
org.opencontainers.image.title="RuyiSDK Backend" | |
org.opencontainers.image.description="Backend for online features of RuyiSDK" | |
org.opencontainers.image.licenses="Apache-2.0" | |
org.opencontainers.image.source="https://github.com/${{ github.repository }}" | |
org.opencontainers.image.url="https://github.com/${{ github.repository }}" | |
org.opencontainers.image.documentation="https://github.com/${{ github.repository }}" | |
org.opencontainers.image.revision="${{ github.sha }}" | |
env: | |
DOCKER_METADATA_SHORT_SHA_LENGTH: 8 | |
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index | |
- name: Build and push | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
context: '.' | |
platforms: linux/amd64 # linux/arm64 too slow to build, linux/riscv64 not yet supported by the base image | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
- name: Generate artifact attestation | |
if: github.event_name != 'pull_request' | |
uses: actions/attest-build-provenance@v2 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
subject-digest: ${{ steps.push.outputs.digest }} # not available if not pushing | |
push-to-registry: ${{ github.event_name != 'pull_request' }} |