diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml deleted file mode 100644 index e50e987..0000000 --- a/.github/workflows/client.yml +++ /dev/null @@ -1,139 +0,0 @@ -# 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/set-variables@v1.2 - 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/xml-replace-action@v0.2 - 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 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..cc701be --- /dev/null +++ b/.github/workflows/main.yml @@ -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/set-variables@v1.2 + 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/xml-replace-action@v0.2 + 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 \ No newline at end of file diff --git a/.github/workflows/proxy.yml b/.github/workflows/proxy.yml deleted file mode 100644 index 14f7f3b..0000000 --- a/.github/workflows/proxy.yml +++ /dev/null @@ -1,34 +0,0 @@ -# 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: Package - -on: - push: - branches: [ "main" ] - tags: - - '*' - pull_request: - branches: [ "main" ] - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - - 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/set-variables@v1.2 - name: Set version - with: - variables: | - VERSION: '${{ github.ref_type }}' == 'tag' ? "${{ steps.release_info.outputs.version }}" : "0.0.0.0" \ No newline at end of file diff --git a/cmd/proxy/debian/changelog.tpl b/cmd/proxy/debian/changelog.tpl new file mode 100644 index 0000000..5f0d41b --- /dev/null +++ b/cmd/proxy/debian/changelog.tpl @@ -0,0 +1,5 @@ +potatodrive-proxy (${VERSION}) UNRELEASED; urgency=medium + + * Debian packaging + + -- Balázs Grill Fri, 10 Apr 2020 07:49:48 +0200 diff --git a/cmd/proxy/debian/compat b/cmd/proxy/debian/compat new file mode 100644 index 0000000..f11c82a --- /dev/null +++ b/cmd/proxy/debian/compat @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/cmd/proxy/debian/conffiles b/cmd/proxy/debian/conffiles new file mode 100644 index 0000000..e69de29 diff --git a/cmd/proxy/debian/control b/cmd/proxy/debian/control new file mode 100644 index 0000000..44f224b --- /dev/null +++ b/cmd/proxy/debian/control @@ -0,0 +1,11 @@ +Source: potatodrive-proxy +Maintainer: Balázs Grill +Section: misc +Priority: optional +Standards-Version: 3.9.2 +Build-Depends: debhelper (>= 9) + +Package: potatodrive-proxy +Architecture: any +Depends: +Description: Proxy server for PotatoDrive \ No newline at end of file diff --git a/cmd/proxy/debian/copyright b/cmd/proxy/debian/copyright new file mode 100644 index 0000000..e69de29 diff --git a/cmd/proxy/debian/rules b/cmd/proxy/debian/rules new file mode 100644 index 0000000..d6761f2 --- /dev/null +++ b/cmd/proxy/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +clean: + rm -f potatodrive-proxy + +build: + cp ../potatodrive-proxy_${DEB_HOST_ARCH} potatodrive-proxy + +binary: + mkdir -p debian/potatodrive-proxy + mkdir -p debian/potatodrive-proxy/usr/bin + sudo cp potatodrive-proxy debian/potatodrive-proxy/usr/bin/ + dh_gencontrol + dh_builddeb \ No newline at end of file diff --git a/cmd/proxy/debian/source/format b/cmd/proxy/debian/source/format new file mode 100644 index 0000000..46ebe02 --- /dev/null +++ b/cmd/proxy/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) \ No newline at end of file diff --git a/go.mod b/go.mod index c820671..c46d76e 100644 --- a/go.mod +++ b/go.mod @@ -5,27 +5,27 @@ go 1.22.0 toolchain go1.23.0 require ( + github.com/apache/thrift v0.21.0 github.com/aws/aws-sdk-go v1.54.20 github.com/fclairamb/afero-s3 v0.3.1 github.com/fsnotify/fsnotify v1.7.0 + github.com/go-ole/go-ole v1.2.6 github.com/google/uuid v1.6.0 github.com/lxn/walk v0.0.0-20210112085537-c389da54e794 + github.com/lxn/win v0.0.0-20210218163916-a377121e959e github.com/pkg/sftp v1.13.6 github.com/rs/zerolog v1.33.0 + github.com/saltosystems/winrt-go v0.0.0-20240510082706-db61b37f5877 github.com/spf13/afero v1.11.0 golang.org/x/crypto v0.23.0 golang.org/x/sys v0.20.0 ) require ( - github.com/apache/thrift v0.21.0 // indirect - github.com/go-ole/go-ole v1.2.6 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/kr/fs v0.1.0 // indirect - github.com/lxn/win v0.0.0-20210218163916-a377121e959e // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/saltosystems/winrt-go v0.0.0-20240510082706-db61b37f5877 // indirect github.com/stretchr/testify v1.8.4 // indirect golang.org/x/text v0.16.0 // indirect gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect diff --git a/go.sum b/go.sum index 43f824d..01e56fa 100644 --- a/go.sum +++ b/go.sum @@ -41,8 +41,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/saltosystems/winrt-go v0.0.0-20240510082706-db61b37f5877 h1:h+mGFGCgqpe2xqFpYtXSqDg3uJ1nYugFb5VQhTHvyL4= -github.com/saltosystems/winrt-go v0.0.0-20240510082706-db61b37f5877/go.mod h1:CIltaIm7qaANUIvzr0Vmz71lmQMAIbGJ7cvgzX7FMfA= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=