diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb15291790b..4bbc034e517 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,10 +9,33 @@ permissions: contents: read jobs: - release-notes: + check_branch: runs-on: ubuntu-latest + outputs: + should_build: ${{ steps.permitted.outputs.result }} - if: github.repository_owner == 'visgl' && (github.ref == 'refs/heads/master' || endsWith(github.ref, '-release')) + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Fetch remote branches + run: | + git fetch origin --depth=1 + + - name: Check if on permitted branch + id: permitted + run: | + result= + branchName=$(git branch -a --contains $GITHUB_SHA | grep 'remotes/origin/' || echo "") + if [[ $branchName == *"master" || $branchName == *"-release" ]]; then + result=true + fi + echo "result=${result}" >> "$GITHUB_OUTPUT" + + release: + runs-on: ubuntu-latest + needs: check_branch + + if: ${{ github.repository_owner == 'visgl' && needs.check_branch.outputs.should_build }} env: ADMIN_TOKEN: ${{ secrets.ADMIN_TOKEN }} @@ -21,9 +44,6 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Get git tags (https://github.com/actions/checkout/issues/206) - run: git fetch --tags -f - - name: Use Node.js uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 with: diff --git a/package.json b/package.json index 69e2b7a05f0..8f66edf765a 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "@math.gl/proj4": "^4.0.0", "@probe.gl/bench": "^4.0.9", "jsdom": "^20.0.0", - "ocular-dev-tools": "2.0.0-alpha.30", + "ocular-dev-tools": "2.0.0-alpha.33", "pre-commit": "^1.2.2", "pre-push": "^0.1.1", "puppeteer": "^22.4.0", diff --git a/scripts/github-release.js b/scripts/github-release.js index 76c16eab492..01f5cc90197 100644 --- a/scripts/github-release.js +++ b/scripts/github-release.js @@ -28,7 +28,7 @@ console.log(JSON.stringify(requestBody)); function getGitTag() { try { - return execSync('git describe --exact-match HEAD', { + return execSync('git describe --tags --exact-match HEAD', { stdio: [null, 'pipe', null], encoding: 'utf-8' }).trim(); diff --git a/yarn.lock b/yarn.lock index 3abc45f2782..9d1137ffc2c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8857,10 +8857,10 @@ object.values@^1.1.7: define-properties "^1.2.0" es-abstract "^1.22.1" -ocular-dev-tools@2.0.0-alpha.30: - version "2.0.0-alpha.30" - resolved "https://registry.yarnpkg.com/ocular-dev-tools/-/ocular-dev-tools-2.0.0-alpha.30.tgz#68f6928142ae5526267988c9ab297e2002194772" - integrity sha512-Kz/mRzI6OHX8ljMZTaal2+iwJGVLzfojiP4l0LgptNCu6vEyV48eVTBD4+rWOrD/uCTCLATKFhBytkMONWK41A== +ocular-dev-tools@2.0.0-alpha.33: + version "2.0.0-alpha.33" + resolved "https://registry.yarnpkg.com/ocular-dev-tools/-/ocular-dev-tools-2.0.0-alpha.33.tgz#c17da68040adfc5cff8e5033d7f0f2afea05d0f7" + integrity sha512-VhEtuT49d94IpV3IqQti21bX0aULhw8a4Pxw765K9axxM07WbgM1be1flcLxgBXZ4qHUy7pzmiuPmZOgkcc5uQ== dependencies: "@babel/cli" "^7.14.5" "@babel/core" "^7.14.5"