diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 6924bb4dfbc..538dfcb1e98 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -202,7 +202,7 @@ jobs: # ------------------------------------------------------------- publish_site: name: Publish - uses: ./.github/workflows/publish-site.yml + uses: ./.github/workflows/publish-site-fastly.yml with: deploy-message: ${{ github.event.pull_request.title }} alias: pr-${{ github.event.number }} diff --git a/.github/workflows/publish-site-fastly.yml b/.github/workflows/publish-site-fastly.yml new file mode 100644 index 00000000000..c27271ed1e3 --- /dev/null +++ b/.github/workflows/publish-site-fastly.yml @@ -0,0 +1,83 @@ +name: Publish documentation +# +# This workflow publishes the documentation to Fastly +# + +on: + workflow_dispatch: + inputs: + deploy-message: + required: false + type: string + alias: + required: false + type: string + workflow_call: + inputs: + deploy-message: + required: false + type: string + alias: + required: false + type: string + +permissions: + contents: read + pull-requests: write + +jobs: + publish_site: + name: Publish to Fastly + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + ## --- SETUP --- ## + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Use Node LTS version + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: yarn + + - name: Enable Corepack + run: corepack enable + + ## --- YARN CACHE --- ## + - name: Check for cached dependencies + continue-on-error: true + id: cache-dependencies + uses: actions/cache@v4 + with: + path: | + .cache/yarn + node_modules + key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }} + + ## --- INSTALL --- ## + # note: if cache-hit isn't needed b/c yarn will leverage the cache if it exists + - name: Install dependencies + shell: bash + run: yarn install --immutable + + ## --- BUILD --- ## + - name: Build storybook + shell: bash + run: yarn build:docs + + - name: Set up Fastly CLI + uses: fastly/compute-actions/setup@v11 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + ## --- DEPLOY WEBSITE TO Fastly --- ## + - name: Deploy to Fastly + uses: fastly/compute-actions/preview@v11 + with: + fastly-api-token: ${{ secrets.FASTLY_API_KEY }} + github-token: ${{ secrets.GITHUB_TOKEN }} + project_directory: dist + timeout-minutes: 10 diff --git a/.gitignore b/.gitignore index 28c3ba85761..a4a5777739b 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,6 @@ chromatic.config.json !.yarn/releases !.yarn/sdks !.yarn/versions + +# Fastly generated builds +compute-js/