Skip to content

Add service account for GitHub action deployments for PYATS #2311

Add service account for GitHub action deployments for PYATS

Add service account for GitHub action deployments for PYATS #2311

Workflow file for this run

name: Deploy web
on:
push:
branches-ignore:
- 'gh-pages'
- 'nobuild_**'
- '**/dependabot**'
- 'dependabot/**'
env:
VITE_MAPTILER_API_KEY: '${{ secrets.MAPTILER_API_KEY }}'
VITE_RESOURCE_BASE: 'https://atip.uk'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install node
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- name: Install wasm-pack
run: |
FOLDER=wasm-pack-v0.15.0-x86_64-unknown-linux-musl
BINARY=wasm-pack
TARGET_FOLDER=~/.cargo/bin
curl -LO "https://github.com/wasm-bindgen/wasm-pack/releases/download/v0.15.0/${FOLDER}.tar.gz"
tar -xzf "${FOLDER}.tar.gz"
mkdir -p "${TARGET_FOLDER}"
mv "${FOLDER}/${BINARY}" "${TARGET_FOLDER}/${BINARY}"
- name: Build all branches
run: |
mkdir deployme
for branch in $(git branch -r | sed 's/origin\///' | grep -v nobuild_ | grep -v 'HEAD -> origin/main'); do
if [ "$branch" == "gh-pages" ]; then
continue
fi
if [[ $branch == dependabot/* ]]; then
echo "Skipping dependabot branch $branch"
continue
fi
if [[ $branch == deployme/* ]]; then
echo "Skipping deployme dependabot branch $branch"
continue
fi
echo "Building $branch"
git checkout $branch
if [ "$branch" == "main" ]; then
base=/atip/
else
base=/atip/$branch
fi
if npm ci && npm run setup-govuk && npm run build -- --base=$base; then
if [ "$branch" == "main" ]; then
mv dist/* deployme
else
mv dist deployme/$branch
fi
else
echo "Building $branch broke; skipping"
fi
done
- name: Publish
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deployme/