Only create tags (not releases) when merging PRs into master (#7462)

* Create a tag instead of a release

* Rename script to 'tags' (not 'release')
This commit is contained in:
Nick Bolton 2024-09-02 14:14:02 +01:00 committed by GitHub
parent 8778a305f4
commit 996fb5c21b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,8 +8,8 @@ on:
- release/**
jobs:
create-release:
if: ${{ vars.CREATE_RELEASE }}
create-tag:
if: ${{ vars.CREATE_TAGS }}
runs-on: ubuntu-latest
timeout-minutes: 10
@ -35,16 +35,15 @@ jobs:
current-version: ${{ env.CURRENT_VERSION }}
override-stage: ${{ env.OVERRIDE_STAGE }}
- name: Print next version
run: echo ${{ steps.next-version.outputs.next-version }}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.ORGANIZATION_TOKEN }}
- name: Create git tag
uses: actions/github-script@v7
with:
tag_name: ${{ steps.next-version.outputs.next-version }}
release_name: ${{ steps.next-version.outputs.next-version }}
draft: false
prerelease: ${{ !startsWith(github.ref, 'refs/heads/release') }}
script: |
const ref = `refs/tags/${{ steps.next-version.outputs.next-version }}`;
const sha = context.sha;
await github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: ref,
sha: sha,
});