Skip to content

Commit

Permalink
update upgrade version tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et committed Sep 12, 2024
1 parent f1f4095 commit e93cd89
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/upgrade-version-by-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Upgrade version by tag

on:
push:
tags:
- 'v*.*.*'

jobs:
upgrade_version:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout code
- name: Checkout code
uses: actions/checkout@v4

# Step 2: Set up Git
- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Step 3: Create a new branch
- name: Create new branch for version update
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
BRANCH_NAME="update-version-${TAG_VERSION}"
git checkout -b $BRANCH_NAME
# Step 4: Update version file
- name: Update version file
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
echo "$TAG_VERSION" > version/version
git add version/version
git commit -m "Update version to $TAG_VERSION"
# Step 5: Push the new branch
- name: Push branch
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
BRANCH_NAME="update-version-${TAG_VERSION}"
git push origin $BRANCH_NAME
# Step 6: Create Pull Request
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: $BRANCH_NAME
title: "Update version to $TAG_VERSION"
body: "This PR updates the version file to the new tag version $TAG_VERSION."
base: main # Replace 'main' with your default branch if necessary
1 change: 1 addition & 0 deletions version/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.0.1
6 changes: 6 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package version

import _ "embed"

//go:embed version
var Version string

0 comments on commit e93cd89

Please sign in to comment.