-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (121 loc) · 3.86 KB
/
client.yml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# 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: Download and install thrift
run: |
$thriftUrl = 'https://dlcdn.apache.org/thrift/0.21.0/thrift-0.21.0.exe'
$thriftPath = Join-Path $env:RUNNER_TOOL_CACHE 'thrift.exe'
Invoke-WebRequest -Uri $thriftUrl -OutFile $thriftPath
echo "$env:RUNNER_TOOL_CACHE" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Get tools
run: |
go install github.com/akavel/rsrc@latest
go install github.com/minio/minio@latest
go install github.com/minio/mc@latest
- name: Generate
env:
NoDefaultCurrentDirectoryInExePath: 1
run: go generate ./...
- name: Test
run: go test -v ./...
- name: Set version to manifest
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