Merge pull request #20 from NxtLvLSoftware/dev-to-dist #20
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: | |
push: | |
branches: [dist] | |
permissions: | |
contents: write | |
env: | |
GITHUB_ACTIONS: true | |
jobs: | |
build-docs: | |
name: Generate site | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
env: | |
NODE_VERSION: 18 | |
steps: | |
- name: Wait for publish success | |
uses: lewagon/[email protected] | |
with: | |
ref: ${{ github.ref }} | |
check-name: Publish to npm registry | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
wait-interval: 10 | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package.json') }} | |
- name: Install dependencies | |
run: npm install | |
- name: Build alpine-typescript | |
run: npm run docs-ci | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pages-docs-html | |
path: ./docs-build | |
build-example: | |
name: Generate example site | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
env: | |
NODE_VERSION: 18 | |
steps: | |
- name: Wait for publish success | |
uses: lewagon/[email protected] | |
with: | |
ref: ${{ github.ref }} | |
check-name: Publish to npm registry | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
wait-interval: 10 | |
- uses: actions/checkout@v3 | |
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@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package.json') }} | |
- name: Install dependencies | |
run: npm install | |
- name: Build example project | |
run: npm run build-ci | |
- uses: actions/upload-artifact@v3 | |
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@v3 | |
with: | |
name: pages-docs-html | |
path: ./ | |
- uses: actions/download-artifact@v3 | |
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@v2 | |
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@v2 |