Publish Pages #34
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: 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 Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('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 Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package.json') }} | |
- 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 |