Skip to content

Webdev 1984

Webdev 1984 #108

Workflow file for this run

name: PullRequestAction
on:
pull_request_target:
branches: [ main ]
# Cancel in-progress jobs or runs for the current pull request
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true
env:
NODE_VERSION: "20.x"
jobs:
process-pull-request:
runs-on: self-hosted
steps:
- name: Fetch git repository
uses: actions/[email protected]
with:
fetch-depth: "0"
- name: Restore main cache first
uses: actions/cache/restore@v3
id: main-cache
with:
path: cache
key: cache-main
- name: Restore PR cache second
uses: actions/cache/restore@v3
id: pr-cache
with:
path: cache
key: cache-${{ github.sha }}
- name: Initialise status
run: /srv/github-action-scripts/init-deploy-preview.sh
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Merge test branch
uses: linaro-its/[email protected]
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Build site
run: |
# Set up the environment variables
export NODE_OPTIONS=--experimental-wasm-modules
export IS_PUBLIC=true
export IS_PREVIEW=true
export CLOUDINARY_CLOUD_NAME=${{ secrets.CLOUDINARY_CLOUD_NAME }}
export CLOUDINARY_API_KEY=${{ secrets.CLOUDINARY_API_KEY }}
export CLOUDINARY_API_SECRET=${{ secrets.CLOUDINARY_API_SECRET }}
export CLOUDINARY_URL=${{ secrets.CLOUDINARY_URL }}
# For pull requests, we set custom domain to the preview URL
export CUSTOM_DOMAIN="${{ vars.AWS_STATIC_SITE_URL }}-${{ github.event.number }}.ghactions.linaro.org"
export AWS_STATIC_SITE_URL=${{ vars.AWS_STATIC_SITE_URL }}
# Build script does yarn install and yarn build
/srv/github-action-scripts/build-astro-site.sh
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache/save@v4
with:
path: cache
key: cache-${{ github.sha }}