Skip to content

fix: brought back the original script #301

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

Merged
merged 1 commit into from
Apr 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions .github/workflows/major-version-updater.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
name: Update major tag for release
on:
release:
types: [released]
types: [published]
workflow_dispatch:
inputs:
TAG_NAME:
description: "Tag name that the major tag will point to (e.g. v1.2.3)"
required: true
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.ref}}
Copy link
Preview

Copilot AI Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using github.ref as a fallback for TAG_NAME may lead to unexpected behavior if the reference is not a tag. Consider verifying that the fallback value is always a tag.

Suggested change
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.ref}}
TAG_NAME: ${{ github.event.inputs.TAG_NAME || (github.ref.startsWith('refs/tags/') && github.ref) || '' }}

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

permissions:
contents: write
jobs:
update_tag:
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@8a4b4f687b72f481b8a241ef71f38857239698fc
with:
source-tag: ${{ env.TAG_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Repo
uses: actions/[email protected]
- name: version
id: version
run: |
tag=${TAG_NAME/refs\/tags\//}
version=${tag#v}
major=${version%%.*}
{ echo "tag=${tag}"; echo "version=${version}"; echo "major=${major}"; } >> "$GITHUB_OUTPUT"
- name: force update major tag
run: |
git tag v${{ steps.version.outputs.major }}
git push origin refs/tags/v${{ steps.version.outputs.major }} -f
Loading