Skip to content

misc: Update README.md #149

misc: Update README.md

misc: Update README.md #149

Workflow file for this run

name: Bump Tag
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- name: get latest tag
id: latest_tag
run: |
git fetch --tags
latest_tag=$(git tag --sort=-creatordate | head -n 1)
if [ -z "$latest_tag" ]; then
latest_tag="0.0.0-preview"
fi
echo "::set-output name=tag::$latest_tag"
- name: bump tag
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const currentTag = '${{ steps.latest_tag.outputs.tag }}';
const [version, suffix] = currentTag.split('-');
const [major, minor, patch] = version.split('.').map(Number);
const newTag = `${major}.${minor}.${patch + 1}-${suffix || 'preview'}`;
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${newTag}`,
sha: context.sha
});
console.log(`New tag created: ${newTag}`);