github peaceiris/actions-gh-pages v2.10.0
Release v2.10.0

latest releases: v3, v3.9.0, v3.8.0...
2 years ago

New Feature

New options tagName, tagMessage, and tagOverwrite.
Suggested by @cinderblock #76 #78

Here is an example workflow.

name: github pages

on:
  push:
    branches:
    - master
    tags:
    - 'v*.*.*'

jobs:
  build-deploy:
    runs-on: ubuntu-18.04
    steps:
    - uses: actions/checkout@v2

    - name: Some build

    - name: Prepare tag
      id: prepare_tag
      if: startsWith(github.ref, 'refs/tags/')
      run: |
        TAG_NAME="${GITHUB_REF##refs/tags/}"
        echo "::set-output name=tag_name::${TAG_NAME}"
        echo "::set-output name=deploy_tag_name::deploy-${TAG_NAME}"

    - name: Deploy
      uses: peaceiris/actions-gh-pages@v2
      env:
        ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
        PUBLISH_BRANCH: gh-pages
        PUBLISH_DIR: ./public
      with:
        tagName: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
        tagMessage: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'

Commands on a local machine.

$ # On the master branch
$ git tag -a "v1.2.3" -m "Release v1.2.3"
$ git push origin "v1.2.3"

$ # After deployment
$ git fetch origin
$ git tag
deploy-v1.2.3  # Tag on the gh-pages branch
v1.2.3         # Tag on the master branch

We can set tagOverwrite option to true for overwriting a tag.

Don't miss a new actions-gh-pages release

NewReleases is sending notifications on new releases.