Update Alarm.vue #38
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 static content to Pages | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: [frontend/**, .github/workflows/**] | |
env: | |
NUXT_APP_BASE_URL: '/Elder-Care-App' | |
NUXT_PUBLIC_API_URL: ${{ vars.NUXT_PUBLIC_API_URL }} | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ github.repository }}_frontend | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: false | |
defaults: | |
run: | |
working-directory: ./frontend | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js v18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install | |
run: yarn install | |
- name: Build | |
run: yarn generate | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
# Upload entire repository | |
path: './frontend/dist' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install cosign | |
if: github.event_name != 'pull_request' | |
uses: sigstore/cosign-installer@v3 | |
with: | |
cosign-release: 'v2.1.1' | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v2 | |
# https://github.com/docker/login-action | |
- name: Login to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/docker/metadata-action | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
labels: git_commit=${{ github.sha }} | |
tags: | | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch | |
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag | |
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=pr | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-buildx- | |
- uses: docker/build-push-action@v4 | |
with: | |
context: ./frontend | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
# linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8 | |
platforms: linux/amd64 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |