Skip to content

Prevent navigation behind NavigationDrawer, take 2 #1834

Prevent navigation behind NavigationDrawer, take 2

Prevent navigation behind NavigationDrawer, take 2 #1834

Workflow file for this run

name: Build and Deploy
on:
push:
branches: ['main']
pull_request:
branches: ['main']
permissions:
contents: read
pull-requests: write
jobs:
build:
name: Build with Node.js
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x, 24.x]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run coverage
sonarqube:
name: SonarQube Analysis
needs: build
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 22.x
cache: 'npm'
- run: npm ci && npm run build && npm run coverage
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v7
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
docker:
name: Docker Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
deploy:
name: Deploy to Cloudflare Pages
needs: build
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' && github.event_name == 'pull_request' }}
outputs:
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
alias-url: ${{ steps.deploy.outputs.pages-deployment-alias-url }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 22.x
cache: 'npm'
- run: npm ci && npm run build-artifact
- name: Get branch names
id: branch-names
uses: tj-actions/branch-names@v9
- name: Prepare deployment with different configuration
run: |
sed -i 's|useDynamicContentInTitle: false,|useDynamicContentInTitle: true,|' packages/pxweb2/dist/config/config.js
- name: Deploy
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: |
pages deploy --branch=${{ steps.branch-names.outputs.current_branch }}
- name: Prepare alternative deployment with different configuration
run: |
mkdir dist
cp -r packages/pxweb2/dist dist/statbank
mv dist/statbank/_headers dist/
mv dist/statbank/index.html dist/
mv dist/statbank/icons/topicIconMapNO.json dist/statbank/icons/topicIconMap.json
echo "/ /statbank/ 301" > dist/_redirects
curl -s -o dist/statbank/config/config.js https://www.ssb.no/statbank/config/config.js
sed -i 's|<base href="/"|<base href="/statbank/"|' dist/index.html
- name: Alternative Deploy
id: alt-deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: |
pages deploy dist --branch=alternative-${{ steps.branch-names.outputs.current_branch }}
- name: Add deployment info to PR description
uses: jupier/powerful-pr-comment@v0.0.5
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
sticky: true
body: |
## Branch Deployment to Cloudflare Pages
:articulated_lorry: Preview URL: ${{ steps.deploy.outputs.deployment-url }}
:construction: Branch preview URL: ${{ steps.deploy.outputs.pages-deployment-alias-url }}
:truck: Alternative Preview URL: ${{ steps.alt-deploy.outputs.deployment-url }}
:construction_worker: Alternative Branch preview URL: ${{ steps.alt-deploy.outputs.pages-deployment-alias-url }}
test:
name: Run Mabl tests
needs: deploy
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.draft == false && github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v6
- name: Regression test against feature branch
id: mabl-test-deployment
uses: mablhq/github-run-tests-action@v1
env:
# Use a "CI/CD Integration" type of mabl API key
MABL_API_KEY: ${{ secrets.MABL_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
plan-labels: |
PxWeb 2.0 Regression Test
browser-types: |
firefox
application-id: ${{ secrets.MABL_APPLICATION_ID}}
environment-id: ${{ secrets.MABL_ENVIRONMENT_ID}}
app-url: ${{needs.deploy.outputs.deployment-url}}