add transpond-io analytics #9
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: "Build preview from PR" | |
on: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | |
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
GH_PR_TOKEN: ${{ secrets.GH_PR_TOKEN }} | |
GH_PR_NUM: ${{ github.event.number }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Fetch gh-pages branch" | |
run: git fetch origin gh-pages --depth=1 | |
- name: "Set permissions" | |
run: chmod -R a+rwX $(pwd) | |
- name: "Build site" | |
run: | | |
podman run -it -v $(pwd):/mnt -w /mnt --userns=keep-id \ | |
quay.io/openssl-ci/docs:20240711-115832 sh -c "\ | |
git config --global --add safe.directory /mnt && \ | |
python build.py master" | |
- name: "Fix ownership" | |
run: sudo chown -R "${USER:-$(id -un)}" $(pwd) | |
- name: "Switch to gh-pages" | |
run: git switch gh-pages | |
- name: "Copy files" | |
run: rsync -r $(pwd) /tmp | |
- name: "Switch back" | |
run: git switch --detach - | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- name: "Install dependencies" | |
run: | | |
echo '{"type": "module"}' > package.json | |
npm install @types/node @octokit/rest surge | |
- name: "Upload site" | |
run: node .github/upload-preview.js /tmp/$(basename $(pwd)) |