Merge branch 'main' of github.com:jazzsequence/profile.github.io #7
This file contains hidden or 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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
precheck: | |
runs-on: ubuntu-latest | |
outputs: | |
should_deploy: ${{ steps.check.outputs.should_deploy }} | |
steps: | |
- name: Check if this is the template | |
id: check | |
run: | | |
if [ "${{ github.repository }}" = "jazzsequence/profile.github.io" ]; then | |
echo "should_deploy=false" >> $GITHUB_OUTPUT | |
echo "Actions running on parent repository. Deploy to GitHub pages will be skipped." | |
else | |
echo "should_deploy=true" >> $GITHUB_OUTPUT | |
echo "Actions running on forked repository. Deploying to GitHub is enabled." | |
fi | |
env: | |
GITHUB_OUTPUT: $GITHUB_OUTPUT | |
deploy: | |
runs-on: ubuntu-latest | |
if: needs.precheck.outputs.should_deploy == 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
- name: Install Dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Configure Git | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
- name: Deploy to GitHub Pages | |
env: | |
CI: true | |
GIT_USER: github-actions[bot] # Add user for gh-pages package | |
GITHUB_TOKEN: ${{ github.token }} # Authenticate with the token | |
run: npx gh-pages -d build --repo https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git | |