Skip to content

Publish Pages

Publish Pages #36

Workflow file for this run

name: Publish Pages
on:
workflow_run:
workflows: ['Publish Package']
branches: [dist]
types: [completed]
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GITHUB_ACTIONS: true
NODE_VERSION: 22
PNPM_VERSION: 9
jobs:
build-docs:
name: Generate site
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Remove README.md index lines
run: |
sed -i '28,127d' README.md
- name: Use pnpm ${{ env.PNPM_VERSION }}
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
run_install: false
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: 'package.json'
- name: Install dependencies
run: npm run clean-install
- name: Build alpine-typescript docs
run: npm run docs-dist
- name: Copy favicon to /docs-build
run: |
cp ./.github/favicon.ico ./docs-build/favicon.ico
- uses: actions/upload-artifact@v4
with:
name: pages-docs-html
path: ./docs-build
build-example:
name: Generate example site
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
examples/project
sparse-checkout-cone-mode: false
- name: Move example files
run: |
mv ./examples/project/* ./
rm -rf ./examples/project
- name: Update alpine-typescript version
run: |
sed -i 's/file:..\/..\//rc/g' package.json
- name: Use pnpm ${{ env.PNPM_VERSION }}
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
run_install: false
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm run clean && pnpm add @nxtlvlsoftware/alpine-typescript@rc
- name: Install dependencies
run: npm run clean-install
- name: Build example project
run: npm run build-dist
- uses: actions/upload-artifact@v4
with:
name: pages-example-html
path: ./dist
package:
name: Package
needs: [build-docs, build-example]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/download-artifact@v4
with:
name: pages-docs-html
path: ./
- uses: actions/download-artifact@v4
with:
name: pages-example-html
path: ./example
- name: Fix permissions
run: |
chmod -c -R +rX "./" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: ./
publish:
name: Publish
needs: [package]
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4