Skip to content

Commit

Permalink
feat: use gh-pages instead of GHA
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Yu <jack.yu@suse.com>
  • Loading branch information
Yu-Jack committed Dec 18, 2024
1 parent 389f474 commit 581c447
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@ jobs:
run: |
yarn install --frozen-lockfile
yarn build
# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./build
- name: Set outputs
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "username=$(git log -1 --pretty=format:'%an')" >> $GITHUB_OUTPUT
echo "email=$(git log -1 --pretty=format:'%ae')" >> $GITHUB_OUTPUT
- name: Deploy to gh-pages branch
run: |
npm install -g gh-pages
GITHUB_REPO_WITH_TOKEN=$(echo ${GITHUB_REPO_LINK} | sed "s/\/\//\/\/git:${GITHUB_TOKEN}@/g")
gh-pages -d build \
-o origin \
-m "deploy: ${COMMIT}" \
-u "${AUTHOR_USER} <${AUTHOR_EMAIL}>" \
-r ${GITHUB_REPO_WITH_TOKEN}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AUTHOR_USER: ${{ steps.vars.outputs.username }}
AUTHOR_EMAIL: ${{ steps.vars.outputs.email }}
COMMIT: ${{ steps.vars.outputs.sha_short }}
GITHUB_REPO_LINK: "${{ github.server_url }}/${{ github.repository }}.git"

0 comments on commit 581c447

Please sign in to comment.