New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add tagName and tagMessage options #78
Conversation
Workflow Example
YAML file: name: github pages
on:
push:
branches:
- master
tags:
- 'v*.*.*'
jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- run: yarn build
- run: yarn export
- run: touch ./out/.nojekyll
- 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.10.0-0
# uses: docker://peaceiris/gh-pages:v2.10.0-0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./out
with:
tagName: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
tagMessage: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}' Commands on a local machinenpm version patch # Create a tag v0.1.4
git push origin master
# A job triggered by a "branches push event" starts.
# Wait a second for a job triggered by a "branches push event" to prevent a conflict with the next job.
git push origin v0.1.4 # push the tag v0.1.4
# A job triggered by a "tags push event" starts. $ git fetch
$ git tag
deploy-v0.1.3
deploy-v0.1.4
v0.1.3
v0.1.4 We can also push tags as follows. git push origin --tags
# OR
git push origin "v$(jq -r '.version' ./package.json)" |
@cinderblock |
Nicely done! Haven't had time to test yet. What about an option to force/replace an existing tag? |
Do you have any use cases of force/replace options? I have no idea and it looks dangerous for me. |
Maybe a mistake was made an someone wants to replace a wrong tag. Yes, it is "dangerous", and that's why it should not be enabled by default. But it should be an option. It's just the |
Add |
v2.10.0 has been released and the stable tag v2 updated. https://github.com/peaceiris/actions-gh-pages/releases/tag/v2.10.0 |
Close #76