Files
yucca/.github/workflows/docs.yml
T

97 lines
2.9 KiB
YAML

name: Docs
# main deploys docs.futo.cloud; a PR gets a docs.pr-<n>.dev.futo.cloud preview
# (torn down by docs-destroy.yml).
on:
push:
branches: [main]
paths: &paths
- 'packages/docs/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- '.npmrc'
- '.mise/config.toml'
- 'tf/pages/**'
- 'tf/op-run.sh'
- '.github/workflows/docs.yml'
pull_request:
paths: *paths
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
ENVIRONMENT: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }}
TF_VAR_stage: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || '' }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Mise
uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0
- run: mise run install:frozen
- run: mise run //packages/docs:build
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: docs-build
path: packages/docs/build
include-hidden-files: true
if-no-files-found: error
retention-days: 1
deploy:
name: Deploy
needs: [build]
if: ${{ !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
pull-requests: write
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ github.ref == 'refs/heads/main' && secrets.OP_TF_YUCCA_PROD_ENV || secrets.OP_TF_YUCCA_STAGING_ENV }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Mise
uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0
- name: Install 1Password CLI
uses: 1password/install-cli-action@a5215d3a7f75c1629216c465ea9ab3ab399c4b71 # v4.0.0
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: docs-build
path: packages/docs/build
- id: deploy
run: mise run //packages/docs:deploy
- name: Preview comment
if: ${{ github.event_name == 'pull_request' }}
uses: immich-app/devtools/actions/sticky-comment@0135acd12ad9f3369b94a2aa3c0ae8c835a4e926 # sticky-comment-action-v1.0.0
with:
id: docs-preview
body: |
<!-- docs-preview -->
### Docs preview ([${{ github.event.pull_request.head.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}))
https://${{ steps.deploy.outputs.hostname }}