ci: enable GH Pages deploy from GHA

This commit is contained in:
Christopher Willis-Ford 2023-09-27 10:28:07 -07:00
parent 17dbe38347
commit 41072301e5

View file

@ -9,11 +9,14 @@ concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true cancel-in-progress: true
permissions:
contents: write
pages: write
packages: write
jobs: jobs:
ci-cd: ci-cd:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
SCRATCH_SHOULD_DEPLOY: ${{ github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/') }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: wagoid/commitlint-github-action@v5 - uses: wagoid/commitlint-github-action@v5
@ -24,10 +27,12 @@ jobs:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
- name: Info - name: Info
run: | run: |
echo "Node version: $(node --version)" cat <<EOF
echo "NPM version: $(npm --version)" Node version: $(node --version)
echo "GitHub ref: ${{ github.ref }}" NPM version: $(npm --version)
echo "GitHub head ref: ${{ github.head_ref }}" GitHub ref: ${{ github.ref }}
GitHub head ref: ${{ github.head_ref }}
EOF
- name: Setup - name: Setup
run: | run: |
npm ci npm ci
@ -35,14 +40,10 @@ jobs:
- run: npm test - run: npm test
- run: npm run build - run: npm run build
- name: Deploy to GH Pages - name: Deploy to GH Pages
if: vars.GH_PAGES_REPO != '' uses: peaceiris/actions-gh-pages@v3
env: with:
GH_PAGES_REPO: ${{ vars.GH_PAGES_REPO }} github_token: ${{ secrets.GITHUB_TOKEN }}
run: | publish_dir: playground
export GIT_AUTHOR_EMAIL="$(git log --pretty=format:"%ae" -n1)" full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"
export GIT_AUTHOR_NAME="$(git log --pretty=format:"%an" -n1)"
export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL}"
export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME}"
npm run deploy -x -r $GH_PAGES_REPO
- name: semantic-release - name: semantic-release
run: npx --no -- semantic-release run: npx --no -- semantic-release