Skip to content

Merge pull request #64 from piny940/fix-gen #36

Merge pull request #64 from piny940/fix-gen

Merge pull request #64 from piny940/fix-gen #36

Workflow file for this run

name: Build App for Production
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
id-token: write
pages: write
packages: write
env:
PNPM_VERSION: 9.12.2
NODE_VERSION: 20.9.0
jobs:
filter:
runs-on: ubuntu-latest
outputs:
frontend: ${{ steps.filter.outputs.frontend }}
spec: ${{ steps.filter.outputs.spec }}
example: ${{ steps.filter.outputs.example }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
frontend:
- "frontend/**"
- ".github/workflows/prd-deploy.yaml"
spec:
- "spec/**"
- ".github/workflows/prd-deploy.yaml"
example:
- "example/**"
- ".github/workflows/prd-deploy.yaml"
prd-build-backend:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
github-actor: ${{ github.actor }}
tags: ghcr.io/${{ github.repository }}-backend:1.0.${{ github.run_number }}
path: "."
prd-build-frontend:
runs-on: ubuntu-latest
environment: production
needs: filter
if: needs.filter.outputs.frontend == 'true'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
github-actor: ${{ github.actor }}
tags: ghcr.io/${{ github.repository }}-frontend:1.0.${{ github.run_number }}
path: "./frontend"
build-args: |
NEXT_PUBLIC_API_URL=https://auth.piny940.com/api/v1
prd-build-example:
runs-on: ubuntu-latest
environment: production
needs: filter
if: needs.filter.outputs.example == 'true'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
github-actor: ${{ github.actor }}
tags: ghcr.io/${{ github.repository }}-example:1.0.${{ github.run_number }}
path: "./example"
build-args: |
NEXT_PUBLIC_API_URL=https://auth.piny940.com/api/v1
build-doc:
runs-on: ubuntu-latest
needs: filter
if: needs.filter.outputs.spec == 'true'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION}}
package_json_file: "spec/package.json"
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "spec/package.json"
- name: Build doc
run: cd spec && pnpm run export
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./spec/out"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4