-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e47354
commit 6dc8c8e
Showing
12 changed files
with
267 additions
and
179 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,232 @@ | ||
name: Main | ||
|
||
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: Build-proxy-amd64 | ||
env: | ||
GOOS: "linux" | ||
GOARCH: "amd64" | ||
run: go build -o potatodrive-proxy-amd64 -X 'main.Version=${{ env.VERSION }}'" ./cmd/proxy | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: potatodrive-proxy-amd64 | ||
path: potatodrive-proxy-amd64 | ||
- name: Build-proxy-armhf | ||
env: | ||
GOOS: "linux" | ||
GOARCH: "arm" | ||
GOARM: "5" | ||
run: go build -o potatodrive-proxy-armhf -X 'main.Version=${{ env.VERSION }}'" ./cmd/proxy | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: potatodrive-proxy-armhf | ||
path: potatodrive-proxy-armhf | ||
|
||
installer: | ||
runs-on: windows-latest | ||
needs: build | ||
steps: | ||
- 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 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: potatodrive.exe | ||
path: potatodrive.exe | ||
- name: Create installer | ||
run: wix build PotatoDrive.wxs -arch x64 | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: PotatoDrive_${{ env.VERSION}}.msi | ||
path: PotatoDrive.msi | ||
|
||
debian-packages: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Install tools | ||
run: | | ||
sudo apt update | ||
sudo apt-get install -y build-essential devscripts debhelper gettext-base | ||
- uses: actions/download-artifact@master | ||
with: | ||
name: potatodrive-proxy-amd64 | ||
path: ./cmd/proxy/potatodrive-proxy-amd64 | ||
- uses: actions/download-artifact@master | ||
with: | ||
name: potatodrive-proxy-armhf | ||
path: ./cmd/proxy/potatodrive-proxy-armhf | ||
- name: Package-armhf | ||
working-directory: ./cmd/proxy | ||
run: | | ||
echo "Version: $VERSION" | ||
envsubst < debian/changelog.tpl > debian/changelog | ||
dpkg-buildpackage --target-arch armhf --host-arch armhf -b | ||
- name: Package-amd64 | ||
working-directory: ./cmd/proxy | ||
run: | | ||
echo "Version: $VERSION" | ||
envsubst < debian/changelog.tpl > debian/changelog | ||
dpkg-buildpackage --target-arch amd64 --host-arch amd64 -b | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: "potatodrive-proxy_${{ env.VERSION }}_armhf.deb" | ||
path: "./cmd/potatodrive-proxy_${{ env.VERSION }}_armhf.deb" | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: "potatodrive-proxy_${{ env.VERSION }}_amd64.deb" | ||
path: "./cmd/potatodrive-proxy_${{ env.VERSION }}_amd64.deb" | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: installer | ||
if: github.ref_type == 'tag' | ||
steps: | ||
- 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 }} | ||
- uses: actions/download-artifact@master | ||
with: | ||
name: PotatoDrive_${{ env.VERSION}}.msi | ||
path: PotatoDrive_${{ env.VERSION}}.msi | ||
- uses: actions/download-artifact@v1 | ||
with: | ||
name: "potatodrive-proxy_${{ env.VERSION }}_armhf.deb" | ||
path: "potatodrive-proxy_${{ env.VERSION }}_armhf.deb" | ||
- uses: actions/download-artifact@v1 | ||
with: | ||
name: "potatodrive-proxy_${{ env.VERSION }}_amd64.deb" | ||
path: "potatodrive-proxy_${{ env.VERSION }}_amd64.deb" | ||
- name: upload Installer | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: PotatoDrive_${{ env.VERSION}}.msi | ||
asset_name: PotatoDrive-${{ env.VERSION }}.msi | ||
asset_content_type: application/x-msi | ||
- name: upload amd64 deb | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: "potatodrive-proxy_${{ env.VERSION }}_amd64.deb" | ||
asset_name: "potatodrive-proxy_${{ env.VERSION }}_amd64.deb" | ||
asset_content_type: application/x-deb | ||
- name: upload armhf deb | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: "potatodrive-proxy_${{ env.VERSION }}_armhf.deb" | ||
asset_name: "potatodrive-proxy_${{ env.VERSION }}_armhf.deb" | ||
asset_content_type: application/x-deb |
Oops, something went wrong.