提交 7b0f65ee 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

Add version check for branch before deploy

上级 2b7e5d79
......@@ -22,11 +22,22 @@ jobs:
- run: ./scripts/docker.sh test
publish:
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/v'))
name: Publish
needs: [build]
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/v[0-9]+'))
runs-on: ubuntu-latest
steps:
- run: curl -X POST -d '{"from":"GitHub Action"}' "$DOCKER_REBUILD_URL"
- name: Check Branch
id: check-branch
run: |
if [[ ${{ github.ref }} =~ ^refs/heads/(master|v[0-9]+\.[0-9]+.*)$ ]]; then
echo ::set-output name=match::true
fi # See: https://stackoverflow.com/a/58869470/1123955
- name: Is A Publish Branch
if: steps.check-branch.outputs.match == 'true'
run: curl -X POST -d '{"from":"GitHub Action"}' "$DOCKER_REBUILD_URL"
env:
DOCKER_REBUILD_URL: ${{ secrets.DOCKER_REBUILD_URL }}
- name: Is Not A Publish Branch
if: steps.check-branch.outputs.match != 'true'
run: echo 'Not A Publish Branch'
......@@ -40,9 +40,9 @@ jobs:
WECHATY_PUPPET_PADPLUS_TOKEN: ${{ secrets.WECHATY_PUPPET_PADPLUS_TOKEN }}
publish:
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/v'))
name: Publish
needs: [build, pack]
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, '/refs/heads/v[0-9]+'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
......@@ -54,6 +54,18 @@ jobs:
- run: ./scripts/generate-version.sh
- run: ./scripts/package-publish-config-tag.sh
- run: npm run dist
- run: npm publish
- name: Check Branch
id: check-branch
run: |
if [[ ${{ github.ref }} =~ ^refs/heads/(master|v[0-9]+\.[0-9]+.*)$ ]]; then
echo ::set-output name=match::true
fi # See: https://stackoverflow.com/a/58869470/1123955
- name: Is A Publish Branch
if: steps.check-branch.outputs.match == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Is Not A Publish Branch
if: steps.check-branch.outputs.match != 'true'
run: echo 'Not A Publish Branch'
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册