Refactor commercial boot process #3073
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches-ignore: | |
- 'gh-pages' | |
permissions: write-all | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
# Temporarily force newer version of corepack | |
# See https://github.com/guardian/support-service-lambdas/pull/2666 | |
- run: npm install --global [email protected] | |
- name: Set up Node | |
uses: ./.github/actions/setup-node-env | |
- name: Run unit tests | |
run: pnpm test -- --ci | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
# Temporarily force newer version of corepack | |
# See https://github.com/guardian/support-service-lambdas/pull/2666 | |
- run: npm install --global [email protected] | |
- name: Set up Node | |
uses: ./.github/actions/setup-node-env | |
- name: Lint files | |
run: pnpm lint | |
- name: Check formatting | |
run: pnpm prettier:check | |
types: | |
name: Type check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
# Temporarily force newer version of corepack | |
# See https://github.com/guardian/support-service-lambdas/pull/2666 | |
- run: npm install --global [email protected] | |
- name: Set up Node | |
uses: ./.github/actions/setup-node-env | |
- name: Check types | |
run: pnpm tsc | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
# Temporarily force newer version of corepack | |
# See https://github.com/guardian/support-service-lambdas/pull/2666 | |
- run: npm install --global [email protected] | |
- name: Set up Node | |
uses: ./.github/actions/setup-node-env | |
- name: Build package | |
run: pnpm build | |
- name: Save build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
release: | |
name: Release | |
needs: [build, test, lint, types] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
# Temporarily force newer version of corepack | |
# See https://github.com/guardian/support-service-lambdas/pull/2666 | |
- run: npm install --global [email protected] | |
- name: Set up Node | |
uses: ./.github/actions/setup-node-env | |
- name: Fetch build | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Use GitHub App Token | |
uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.GU_CHANGESETS_APP_ID }} | |
private-key: ${{ secrets.GU_CHANGESETS_PRIVATE_KEY }} | |
- name: Set git user to Gu Changesets app | |
run: | | |
git config user.name "gu-changesets-release-pr[bot]" | |
git config user.email "gu-changesets-release-pr[bot]@users.noreply.github.com" | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: pnpm changeset publish | |
title: '🦋 Release package updates' | |
commit: 'Bump package versions' | |
setupGitUser: false | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
riff-raff: | |
name: Upload Riff Raff Artifacts | |
needs: [build, test, lint, types] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
# Temporarily force newer version of corepack | |
# See https://github.com/guardian/support-service-lambdas/pull/2666 | |
- run: npm install --global [email protected] | |
- name: Set up Node | |
uses: ./.github/actions/setup-node-env | |
- name: Fetch build | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Riff-Raff Upload | |
uses: guardian/actions-riff-raff@v4 | |
with: | |
roleArn: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
projectName: dotcom::commercial-bundle | |
configPath: ./riff-raff.yaml | |
contentDirectories: | | |
frontend-static/commercial: | |
- dist/prod/artifacts/commercial | |
commercial-bundle-path: | |
- dist/prod/cloudformation |