Fixed cosmos-flower.md #44
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 and Deploy to GitHub Pages | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# Producing the static files | |
build: | |
runs-on: ubuntu-latest | |
env: | |
SERVER_PREFIX: "" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Print environment variable | |
run: echo "Domain prefix is $DOMAIN_PREFIX" | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: Install dependencies | |
run: npm ci | |
- name: Build project | |
run: npm run build | |
- name: Start script | |
run: npm run start | |
- name: Rename files with invalid characters | |
run: | | |
find ./public -name "*:*" | while read file; do | |
mv "$file" "$(echo $file | tr ':' '_')" | |
done | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-files | |
path: . | |
deploy: | |
environment: | |
name: production | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-files | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Add CNAME file | |
run: echo "lanka.wiki" > ./public/CNAME | |
- name: Upload artifact to GitHub Pages | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./public # Path should match where your built files are extracted | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |