mirror of
https://github.com/immich-app/geoshenanigans.git
synced 2026-09-30 21:27:57 +08:00
188 lines
6.0 KiB
YAML
188 lines
6.0 KiB
YAML
name: Tiles Worker
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ./tiles
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version-file: './tiles/.nvmrc'
|
|
|
|
- name: Run npm install
|
|
run: npm ci
|
|
|
|
- name: Run linter
|
|
run: npm run lint
|
|
if: ${{ !cancelled() }}
|
|
|
|
- name: Run formatter
|
|
run: npm run format
|
|
if: ${{ !cancelled() }}
|
|
|
|
- name: Run tsc
|
|
run: npm run check
|
|
if: ${{ !cancelled() }}
|
|
|
|
- name: Run unit tests & coverage
|
|
run: npm run test:cov
|
|
if: ${{ !cancelled() }}
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ./tiles
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version-file: './tiles/.nvmrc'
|
|
|
|
- name: Run npm install
|
|
run: npm ci
|
|
|
|
- name: Run tsc
|
|
run: npm run check
|
|
if: ${{ !cancelled() }}
|
|
|
|
- name: Wrangler build
|
|
run: npm run build
|
|
if: ${{ !cancelled() }}
|
|
|
|
- name: Upload build output
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: tiles-build-output
|
|
path: tiles/dist
|
|
retention-days: 14
|
|
if: ${{ !cancelled() }}
|
|
|
|
check-terragrunt:
|
|
name: Check Terragrunt
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: deployment
|
|
steps:
|
|
- name: 'Checkout'
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- id: token
|
|
uses: immich-app/devtools/actions/create-workflow-token@df46d635b905e618b88fc4c95baa920aeb30b309 # create-workflow-token-action-v3.0.1
|
|
with:
|
|
client-id: ${{ secrets.PUSH_O_MATIC_APP_CLIENT_ID }}
|
|
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }}
|
|
permission-contents: read
|
|
|
|
- name: Setup Mise
|
|
uses: immich-app/devtools/actions/use-mise@06a9ef925332c91be647d6256642b86b398592c8 # use-mise-action-v3.2.1
|
|
with:
|
|
github_token: ${{ steps.token.outputs.token }}
|
|
|
|
- name: Check Formatting
|
|
run: terragrunt hcl fmt --check --diff
|
|
|
|
- name: Check TF fmt
|
|
env:
|
|
ENVIRONMENT: dev
|
|
OP_SERVICE_ACCOUNT_TOKEN: ${{ matrix.environment == 'prod' && secrets.OP_TF_PROD_ENV || secrets.OP_TF_DEV_ENV }}
|
|
TF_VAR_tiles_build_dir: "${{ github.workspace }}/dist"
|
|
run: op run --env-file=".env" -- terragrunt run --all fmt -- -diff -check
|
|
|
|
plan-terragrunt:
|
|
needs: build
|
|
name: Plan Terragrunt
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
environment: [dev, prod]
|
|
if: github.ref != 'refs/heads/main' && github.event_name != 'workflow_dispatch'
|
|
steps:
|
|
- name: 'Checkout'
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- id: token
|
|
uses: immich-app/devtools/actions/create-workflow-token@df46d635b905e618b88fc4c95baa920aeb30b309 # create-workflow-token-action-v3.0.1
|
|
with:
|
|
client-id: ${{ secrets.PUSH_O_MATIC_APP_CLIENT_ID }}
|
|
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }}
|
|
permission-contents: read
|
|
|
|
- name: Setup Mise
|
|
uses: immich-app/devtools/actions/use-mise@06a9ef925332c91be647d6256642b86b398592c8 # use-mise-action-v3.2.1
|
|
with:
|
|
github_token: ${{ steps.token.outputs.token }}
|
|
|
|
- name: 'Get build artifact'
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: tiles-build-output
|
|
path: "${{ github.workspace }}/dist"
|
|
|
|
- name: Plan All
|
|
working-directory: ${{ github.workspace }}/deployment
|
|
env:
|
|
ENVIRONMENT: ${{ matrix.environment }}
|
|
OP_SERVICE_ACCOUNT_TOKEN: ${{ matrix.environment == 'prod' && secrets.OP_TF_PROD_ENV || secrets.OP_TF_DEV_ENV }}
|
|
TF_VAR_tiles_build_dir: "${{ github.workspace }}/dist"
|
|
run: op run --env-file=".env" -- terragrunt run --all plan
|
|
|
|
deploy-terragrunt:
|
|
needs: [build, test]
|
|
name: Deploy Terragrunt
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main'
|
|
env:
|
|
ENVIRONMENT: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }}
|
|
steps:
|
|
- name: 'Checkout'
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- id: token
|
|
uses: immich-app/devtools/actions/create-workflow-token@df46d635b905e618b88fc4c95baa920aeb30b309 # create-workflow-token-action-v3.0.1
|
|
with:
|
|
client-id: ${{ secrets.PUSH_O_MATIC_APP_CLIENT_ID }}
|
|
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }}
|
|
permission-contents: read
|
|
|
|
- name: Setup Mise
|
|
uses: immich-app/devtools/actions/use-mise@06a9ef925332c91be647d6256642b86b398592c8 # use-mise-action-v3.2.1
|
|
with:
|
|
github_token: ${{ steps.token.outputs.token }}
|
|
|
|
- name: 'Get build artifact'
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: tiles-build-output
|
|
path: "${{ github.workspace }}/dist"
|
|
|
|
- name: Deploy All
|
|
working-directory: ${{ github.workspace }}/deployment
|
|
env:
|
|
OP_SERVICE_ACCOUNT_TOKEN: ${{ github.ref == 'refs/heads/main' && secrets.OP_TF_PROD_ENV || secrets.OP_TF_DEV_ENV }}
|
|
TF_VAR_tiles_build_dir: "${{ github.workspace }}/dist"
|
|
run: op run --env-file=".env" -- terragrunt run --all apply --non-interactive
|