mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-03 10:37:48 +09:00
experimental: SSG download support (#3783)
## Description See corresponding [SaaS PR](https://github.com/webstudio-is/webstudio-saas/pull/311) too ## Steps for reproduction Click Publish/Export <img width="363" alt="image" src="https://github.com/user-attachments/assets/fbc1f4e5-3a2c-4bb9-9242-025196f991bc"> Deploy zip to netlify <img width="1710" alt="image" src="https://github.com/user-attachments/assets/daca4ead-6272-4729-8e82-0986301e5c8b"> ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
This commit is contained in:
1 parent
1f435cc7f9
commit
8be665e68d
38 files changed
+701
-73
No files matched your search
@@ -0,0 +1,104 @@
|
||||
name: CLI R2 SSG
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "*.staging"
|
||||
|
||||
# cancel in-progress runs on new commits to same PR (gitub.event.number)
|
||||
concurrency:
|
||||
group: vercel-cli-r2-static-${{ github.workflow }}-${{ github.event.number || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
statuses: write # This is required for the GitHub Script createCommitStatus to work
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
COMPATIBILITY_DATE: 2024-04-10
|
||||
|
||||
environment:
|
||||
name: "staging"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.sha }} # HEAD commit instead of merge commit
|
||||
|
||||
- uses: pnpm/action-setup@v3
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: pnpm
|
||||
|
||||
- name: pnpm instal
|
||||
run: pnpm install --ignore-scripts
|
||||
|
||||
- name: pnpm build
|
||||
run: pnpm --filter 'ssg^...' run build
|
||||
|
||||
# Ideally, execute 'pnpm deploy --prod', but @remix-run/dev doesn't support this flag.
|
||||
# Despite being listed as a dependency, @remix-run/dev does not install the remix cli.
|
||||
# TODO: Minimize artefact size due to frequent downloads on each publish.
|
||||
- name: pnpm deploy
|
||||
run: pnpm --filter 'ssg' deploy "${{ github.workspace }}/../ssg-template"
|
||||
|
||||
- name: Make archive
|
||||
run: |
|
||||
tar --use-compress-program="zstd -19" -cf ssg-template.tar.zst ssg-template
|
||||
working-directory: ${{ github.workspace }}/..
|
||||
|
||||
- name: Copy artifact
|
||||
run: |
|
||||
# For staging
|
||||
aws s3 cp ssg-template.tar.zst "s3://${ARTEFACT_BUCKET_NAME}/public/ssg-template/${{ github.ref_name }}.tar.zst"
|
||||
|
||||
# For production can be cached forever
|
||||
aws s3 cp \
|
||||
--metadata-directive REPLACE --cache-control "public,max-age=31536102,immutable" \
|
||||
ssg-template.tar.zst "s3://${ARTEFACT_BUCKET_NAME}/public/ssg-template/${{ github.sha }}.tar.zst"
|
||||
|
||||
working-directory: ${{ github.workspace }}/..
|
||||
env:
|
||||
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
|
||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
ARTEFACT_BUCKET_NAME: ${{ secrets.ARTEFACT_BUCKET_NAME }}
|
||||
|
||||
checks:
|
||||
environment:
|
||||
name: "staging"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: "9"
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Copy atrifact via http
|
||||
run: curl -o ssg-template.tar.zst ${{ secrets.ARTEFACT_BUCKET_URL }}/public/ssg-template/${{ github.ref_name }}.tar.zst
|
||||
|
||||
- name: Extract archive
|
||||
run: tar --use-compress-program="zstd -d" -xf ssg-template.tar.zst -C .
|
||||
|
||||
- name: Webstudio Build
|
||||
run: pnpm webstudio build --template ssg --template internal --preview
|
||||
working-directory: ${{ github.workspace }}/ssg-template
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
working-directory: ${{ github.workspace }}/ssg-template
|
||||
Reference in new issue
Block a user