diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..11cbd8d --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,181 @@ +name: Test + +on: + push: + branches: ["*"] + +permissions: + contents: write + +jobs: + build-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + lfs: true + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.22 + - name: Install fyne-cross + run: go install github.com/fyne-io/fyne-cross@latest + - name: Cross-compile for Linux + run: fyne-cross linux + - name: Upload Linux artifact + uses: actions/upload-artifact@v4 + with: + name: linux-build + path: fyne-cross/bin/linux-amd64 + + build-windows: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + lfs: true + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.22 + - name: Install fyne-cross + run: go install github.com/fyne-io/fyne-cross@latest + - name: Cross-compile for Windows + run: fyne-cross windows + - name: Upload Windows artifact + uses: actions/upload-artifact@v4 + with: + name: windows-build + path: fyne-cross/bin/windows-amd64 + + build-mac: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + lfs: true + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.22 + - name: Compile for MacOS + run: | + GOOS=darwin GOARCH=arm64 go build -o SoundscapeSync_arm64 + CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o SoundscapeSync_amd64 + lipo -create -output SoundscapeSync SoundscapeSync_amd64 SoundscapeSync_arm64 + mkdir -p SoundscapeSync.app/Contents/MacOS + mv SoundscapeSync SoundscapeSync.app/Contents/MacOS/SoundscapeSync + echo '' > SoundscapeSync.app/Contents/Info.plist + echo '' >> SoundscapeSync.app/Contents/Info.plist + echo '' >> SoundscapeSync.app/Contents/Info.plist + echo '' >> SoundscapeSync.app/Contents/Info.plist + echo ' CFBundleName' >> SoundscapeSync.app/Contents/Info.plist + echo ' SoundscapeSync' >> SoundscapeSync.app/Contents/Info.plist + echo ' CFBundleVersion' >> SoundscapeSync.app/Contents/Info.plist + echo ' 1.0' >> SoundscapeSync.app/Contents/Info.plist + echo ' CFBundleIdentifier' >> SoundscapeSync.app/Contents/Info.plist + echo ' com.cloonar.soundscape-sync' >> SoundscapeSync.app/Contents/Info.plist + echo ' Executable' >> SoundscapeSync.app/Contents/Info.plist + echo ' SoundscapeSync' >> SoundscapeSync.app/Contents/Info.plist + echo '' >> SoundscapeSync.app/Contents/Info.plist + echo '' >> SoundscapeSync.app/Contents/Info.plist + chmod +x SoundscapeSync.app/Contents/MacOS/SoundscapeSync + zip -r SoundscapeSync.app.zip SoundscapeSync.app + - name: Upload macOS artifact + uses: actions/upload-artifact@v4 + with: + name: macos-build + path: SoundscapeSync.app.zip + + create-release: + runs-on: ubuntu-latest + needs: [build-linux, build-windows, build-mac] + steps: + - name: Generate Changelog + id: changelog + uses: requarks/changelog-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag: v0.9 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v0.9 + release_name: Release test + body: ${{ steps.changelog.outputs.changes }} + draft: true + prerelease: true + + # - uses: actions/download-artifact@v4 + # with: + # name: linux-build + # - name: Prepare DEB package + # run: | + # mkdir -p .debpkg/DEBIAN + # echo "Package: SoundscapeSync" > .debpkg/DEBIAN/control + # echo "Version: ${{ github.event.inputs.version }}" >> .debpkg/DEBIAN/control + # echo "Architecture: amd64" >> .debpkg/DEBIAN/control + # echo "Maintainer: Dominik Polakovics " >> .debpkg/DEBIAN/control + # mkdir -p .debpkg/usr/bin + # cp fyne-cross/bin/linux-amd64/soundscape-sync .debpkg/usr/bin + # - name: Create DEB package + # uses: jiro4989/build-deb-action@v3 + # with: + # package: SoundscapeSync + # package_root: .debpkg + # maintainer: "Dominik Polakovics " + # version: "${{ github.event.inputs.version }}" + # arch: 'amd64' + # desc: 'This is my sample package.' + # depends: 'ffmpeg' + # - name: get file name + # run: | + # mv *.deb soundscapesync-${{ github.event.inputs.version }}.deb + - uses: actions/download-artifact@v4 + with: + name: linux-build + - name: Upload Linux Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: soundscape-sync + asset_name: soundscape-sync-linux-x86 + asset_content_type: application/octet-stream + + - uses: actions/download-artifact@v4 + with: + name: windows-build + - name: Upload Windows Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: SoundscapeSync.exe + asset_name: SoundscapeSync.exe + asset_content_type: application/x-msdownload + + - uses: actions/download-artifact@v4 + with: + name: macos-build + - name: Upload MacOS Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: SoundscapeSync.app.zip + asset_name: MacOS.zip + asset_content_type: application/zip + + + - name: Generate Release Hashes + uses: MCJack123/ghaction-generate-release-hashes@v3 + with: + hash-type: sha256 + file-name: CHECKSUMS.txt