Skip to content

Commit 9383084

Browse files
committed
github actions
1 parent 3d686a8 commit 9383084

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.github/workflows/release.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
name: Release for ${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
include:
15+
- os: ubuntu-latest
16+
artifact_name: dh
17+
asset_name: dh-linux-amd64
18+
- os: windows-latest
19+
artifact_name: dh.exe
20+
asset_name: dh-windows-amd64.exe
21+
- os: macos-latest
22+
artifact_name: dh
23+
asset_name: dh-macos-amd64
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Build
28+
run: cargo build --release --locked
29+
- name: Upload binaries to release
30+
uses: svenstaro/upload-release-action@v2
31+
with:
32+
repo_token: ${{ secrets.GITHUB_TOKEN }}
33+
file: target/release/${{ matrix.artifact_name }}
34+
asset_name: ${{ matrix.asset_name }}
35+
tag: ${{ github.ref }}

increment-version.ps1

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Get the latest tag
2+
$latestTag = git describe --tags --abbrev=0
3+
4+
# If there's no tag yet, start with v0.1.0
5+
if (-not $latestTag) {
6+
$latestTag = "v0.1.0"
7+
}
8+
9+
# Extract the version numbers
10+
$version = $latestTag -replace '^v'
11+
$major, $minor, $patch = $version -split '\.'
12+
13+
# Increment the patch version
14+
$patch = [int]$patch + 1
15+
16+
# Create the new version string
17+
$newVersion = "v$major.$minor.$patch"
18+
19+
# Create a new tag
20+
git tag -a $newVersion -m "Release $newVersion"
21+
22+
# Push the new tag to origin
23+
git push origin $newVersion
24+
25+
Write-Host "Created and pushed new tag: $newVersion"

0 commit comments

Comments
 (0)