-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: added github action + version bumping script and goreleaser c…
…onfig Signed-off-by: deggja <danieldagfinrud@gmail.com>
- Loading branch information
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# Fetch tags | ||
git fetch --tags | ||
|
||
# Get the latest tag | ||
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`) | ||
|
||
# If there are no tags yet, start with 0.0.1 | ||
if [ -z "$latest_tag" ]; then | ||
new_tag="0.0.1" | ||
else | ||
# Increment the version | ||
major=$(echo $latest_tag | cut -d. -f1) | ||
minor=$(echo $latest_tag | cut -d. -f2) | ||
patch=$(echo $latest_tag | cut -d. -f3) | ||
if [ $patch -lt 99 ]; then | ||
let patch+=1 | ||
else | ||
let minor+=1 | ||
patch=0 | ||
fi | ||
new_tag="${major}.${minor}.${patch}" | ||
fi | ||
|
||
# Set output for the next steps | ||
echo "Setting new tag to $new_tag" | ||
echo "::set-output name=new_tag::$new_tag" | ||
|
||
# Create the new tag | ||
git tag $new_tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-release: | ||
name: Build and Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
|
||
- name: Bump version and tag | ||
id: bump_version | ||
run: | | ||
chmod +x .github/scripts/bump_version.sh | ||
.github/scripts/bump_version.sh | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist --tag ${{ steps.bump_version.outputs.new_tag }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# .goreleaser.yml | ||
project_name: netfetch # Replace with your project name | ||
|
||
# Build configuration | ||
builds: | ||
- id: "netfetch" | ||
main: ./cmd/netfetch/main.go # Path to your main.go file | ||
binary: netfetch | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
# Additional build flags can be added here | ||
|
||
# Archive configuration | ||
archives: | ||
- id: "archive" | ||
builds: | ||
- netfetch | ||
format: tar.gz | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
wrap_in_directory: true | ||
|
||
# Release configuration | ||
release: | ||
github: | ||
owner: deggja | ||
name: netfetch | ||
draft: false |