Skip to content

Update branch tags only when releases are made #38

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
47 changes: 12 additions & 35 deletions .github/workflows/update-main-version.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,18 @@
name: Update Main Version
run-name: Move ${{ github.event.inputs.major_version || 'latest branch tag' }} to ${{ github.event.inputs.target || github.sha }}
name: Update release version

on:
push:
tags:
- 'v[0-9]+.**'
workflow_dispatch:
inputs:
target:
description: The tag or reference to use
required: true
major_version:
type: choice
description: The major version to update
options:
- v1
permissions:
contents: write

env:
MAJOR_VERSION: 'v1'
on:
release:
types: [published]

jobs:
tag:
update-version:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Git config
run: |
git config user.name github-actions
git config user.email [email protected]
#- name: Get major version from tag name
# if: ${{ github.event_name === 'push' }}
# run: echo "MAJOR_VERSION=`echo ${GITHUB_REF#refs/*/} | cut -c1-2`" >> $GITHUB_ENV
- name: Tag new target
run: git tag -f ${{ github.event.inputs.major_version || env.MAJOR_VERSION }} ${{ github.event.inputs.target || github.sha }}
- name: Push new tag
run: git push origin ${{ github.event.inputs.major_version || env.MAJOR_VERSION }} --force
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run release-tagger
uses: tj-actions/release-tagger@v4