forked from PopHIVE/Ingest
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.94 KB
/
version.yaml
File metadata and controls
61 lines (51 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Auto Version and Release
on:
push:
branches:
- main
jobs:
version-and-release:
runs-on: ubuntu-latest
permissions:
contents: write # Needed to push tags and create releases
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper versioning
- name: Get latest tag
id: get_tag
run: |
# Get the latest tag, or start at v0.0.0 if none exists
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
- name: Bump version
id: bump_version
run: |
LATEST_TAG="${{ steps.get_tag.outputs.latest_tag }}"
# Remove 'v' prefix if present
VERSION=${LATEST_TAG#v}
# Split version into parts
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
# Increment patch version
PATCH=$((PATCH + 1))
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ steps.bump_version.outputs.new_version }}
git push origin ${{ steps.bump_version.outputs.new_version }}
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump_version.outputs.new_version }}
release_name: Release ${{ steps.bump_version.outputs.new_version }}
body: |
Auto-generated release for ${{ steps.bump_version.outputs.new_version }}
Commit: ${{ github.sha }}
draft: false
prerelease: false