Browse Source

fix: incorrect SHA while tagging in release

feat/0523-export-schema
Wing-Kam Wong 3 years ago committed by Raju Udava
parent
commit
c24c249439
  1. 27
      .github/workflows/release-draft.yml

27
.github/workflows/release-draft.yml

@ -26,22 +26,35 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Get SHA
id: get-sha
# If it's triggered by release-nocodb.yml,
# the SHA from the third commit (i.e. Auto PR from master to develop) will be taken
# else HEAD will be taken
run: |
TARGET_SHA=$(git rev-parse HEAD~2)
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
TARGET_SHA=$(git rev-parse HEAD)
fi
echo "::set-output name=TARGET_SHA::${TARGET_SHA}"
echo "Setting TARGET_SHA: ${{steps.get-sha.outputs.TARGET_SHA}}"
- name: Create tag - name: Create tag
uses: actions/github-script@v3 uses: actions/github-script@v3
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} # need workflows permission but it's not in GITHUB_TOKEN scope
# need a custom PAT with workflows permission here
github-token: ${{ secrets.NC_GITHUB_TOKEN }}
script: | script: |
github.git.createRef({ github.git.createRef({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
ref: "refs/tags/${{ github.event.inputs.tag || inputs.tag }}", ref: "refs/tags/${{ github.event.inputs.tag || inputs.tag }}",
sha: context.sha sha: "${{steps.get-sha.outputs.TARGET_SHA}}"
}) })
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: 16 node-version: 16

Loading…
Cancel
Save