Skip to content

Commit

Permalink
Release in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsgrill committed Aug 21, 2024
1 parent b5138bf commit a091d78
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
39 changes: 38 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ name: Go
on:
push:
branches: [ "main" ]
tags:
- '*'
pull_request:
branches: [ "main" ]

Expand All @@ -16,6 +18,21 @@ jobs:
steps:
- uses: actions/checkout@v4

- id: get_version
if: contains(github.ref, 'tags/')
name: Get version
uses: jannemattila/get-version-from-tag@v3

- id: set_version
if: contains(github.ref, 'tags/')
name: Set version
run: VERSION=$(echo "${{ steps.get_version.outputs.version }}")

- id: set_version
if: '!contains(github.ref, "tags/")'
name: Set version
run: VERSION=0.0.0-dev

- name: Check out winrt-go fork
uses: actions/checkout@v4
with:
Expand All @@ -41,7 +58,7 @@ jobs:
run: go generate ./...

- name: Build
run: go build -o potatodrive.exe -ldflags="-H windowsgui" ./cmd/main
run: go build -o potatodrive.exe -ldflags="-H windowsgui -X 'main.Version=$VERSION'" ./cmd/main
- uses: actions/upload-artifact@v4
with:
name: potatodrive.exe
Expand All @@ -60,3 +77,23 @@ jobs:
with:
name: PotatoDrive.msi
path: PotatoDrive.msi

- name: release
uses: ncipollo/release-action@v1
id: create_release
with:
allowUpdates: true
draft: false
prerelease: false
name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: upload HTML report
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: PotatoDrive.msi
asset_name: Windows 64 bit installer
asset_content_type: application/x-msi
3 changes: 3 additions & 0 deletions cmd/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import (
"github.com/balazsgrill/potatodrive/bindings"
)

var Version string = "0.0.0-dev"

func main() {
mgr, err := New()
if err != nil {
log.Print(err)
return
}
mgr.Logger.Info().Str("version", Version).Msg("Starting PotatoDrive")
ui := createUI(UIContext{
Logger: mgr.Logger,
LogFile: mgr.logfilepath,
Expand Down

0 comments on commit a091d78

Please sign in to comment.