Skip to content

propagate version into manifest #54

propagate version into manifest

propagate version into manifest #54

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
tags:
- '*'
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Check out winrt-go fork
uses: actions/checkout@v4
with:
repository: balazsgrill/winrt-go
path: winrt-go
- name: Get release info
id: release_info
if: github.ref_type == 'tag'
uses: revam/gh-action-get-tag-and-version@v1
with:
tag: ${{ github.ref }}
prefix: v
prefixRegex: "[vV]?"
- id: set_version
uses: marcdomain/[email protected]
name: Set version
with:
variables: |
VERSION: '${{ github.ref_type }}' == 'tag' ? "${{ steps.release_info.outputs.version }}" : "0.0.0.0"
- name: enable Projection FS
run: Enable-WindowsOptionalFeature -Online -FeatureName Client-ProjFS -NoRestart
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Get tools
run: |
go install github.com/akavel/rsrc@latest
- name: Test
run: go test -v ./...
- name: Generate
run: go generate ./...
- name: Set logback env values
uses: rvolo/[email protected]
with:
filepath: "cmd/main/main.exe.manifest"
xpath: "//assembly/assemblyIdentity/@version"
replace: "${{ env.VERSION }}"
- name: Build
run: go build -o potatodrive.exe -ldflags="-H windowsgui -X 'main.Version=${{ env.VERSION }}'" ./cmd/main
- name: Compress
uses: crazy-max/ghaction-upx@v3
with:
version: latest
files: |
./potatodrive.exe
args: -9
- uses: actions/upload-artifact@v4
with:
name: potatodrive.exe
path: potatodrive.exe
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 5.x
- name: Install wix
run: |
dotnet tool install --global wix
- name: Substitute version
uses: bluwy/substitute-string-action@v3
with:
_input-file: PotatoDrive-vars.wxi.tpl
_output-file: PotatoDrive-vars.wxi
_format-key: '%%key%%'
Version: ${{ env.VERSION}}
- uses: actions/upload-artifact@v4
with:
name: PotatoDrive-vars.wxi
path: PotatoDrive-vars.wxi
- name: Create installer
run: wix build PotatoDrive.wxs -arch x64
- uses: actions/upload-artifact@v4
with:
name: PotatoDrive_${{ env.VERSION}}.msi
path: PotatoDrive.msi
- name: release
uses: ncipollo/release-action@v1
id: create_release
if: github.ref_type == 'tag'
with:
allowUpdates: true
draft: false
prerelease: false
name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: upload Installer
if: github.ref_type == 'tag'
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: PotatoDrive-${{ env.VERSION }}.msi
asset_content_type: application/x-msi