Skip to content

Update2 (#9)

Update2 (#9) #23

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches:
- master # Adjust if your default branch is named differently, e.g., main
issues:
types:
- opened # Trigger the workflow when an issue is opened
jobs:
build:
if: github.event_name == 'issues' && github.event.issue.body == 'Update' || github.event_name == 'push'
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v4
# Step 3: Install latest version of poolzfinance/reacthelper
- name: Install dependencies
run: npm i @poolzfinance/reacthelper
# Step 4: Build the project (generate JSON files and copy index.html)
- name: Build project
run: npm run generate # This should generate the `dist` folder
# Step 5: Upload static files as artifact
- name: Upload artifact for deployment
uses: actions/upload-pages-artifact@v3
with:
path: dist/ # The folder that contains the built files
deploy:
# Deploy job depends on the build job
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
# Step 6: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# Step 7: Close the issue
- name: Close issue
if: github.event_name == 'issues'
run: |
curl -X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \
-d '{"state": "closed"}'