diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d7e08013..bd3b7813 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,8 +5,8 @@ on: branches: [main] jobs: - deploy: - name: Deploy to GitHub Pages + build: + name: Build and Upload Static Files runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -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 \ No newline at end of file + - 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" \ No newline at end of file