name: release on: workflow_dispatch: # push: # tags: # - 'v*' jobs: build-and-release: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Generate changelog run: | echo -e "$(git log $(git describe --tags --abbrev=0)..HEAD --oneline | awk '{print "- "$0}')" > CHANGELOG.md - name: install lipo run: | curl -L -o /tmp/lipo https://github.com/konoui/lipo/releases/latest/download/lipo_Linux_amd64 chmod +x /tmp/lipo mv /tmp/lipo /usr/local/bin - name: Build Go binaries run: | #!/bin/bash export CGO_ENABLED=0 mkdir -p artifacts export GOOS=windows export GOARCH=amd64 export FILENAME=artifacts/go2rtc_win64.zip go build -ldflags "-s -w" -trimpath && 7z a -mx9 -sdel "$FILENAME" go2rtc.exe export GOOS=windows export GOARCH=386 export FILENAME=artifacts/go2rtc_win32.zip go build -ldflags "-s -w" -trimpath && 7z a -mx9 -sdel "$FILENAME" go2rtc.exe export GOOS=windows export GOARCH=arm64 export FILENAME=artifacts/go2rtc_win_arm64.zip go build -ldflags "-s -w" -trimpath && 7z a -mx9 -sdel "$FILENAME" go2rtc.exe export GOOS=linux export GOARCH=amd64 export FILENAME=artifacts/go2rtc_linux_amd64 go build -ldflags "-s -w" -trimpath -o "$FILENAME" export GOOS=linux export GOARCH=386 export FILENAME=artifacts/go2rtc_linux_i386 go build -ldflags "-s -w" -trimpath -o "$FILENAME" export GOOS=linux export GOARCH=arm64 export FILENAME=artifacts/go2rtc_linux_arm64 go build -ldflags "-s -w" -trimpath -o "$FILENAME" export GOOS=linux export GOARCH=arm export GOARM=7 export FILENAME=artifacts/go2rtc_linux_arm go build -ldflags "-s -w" -trimpath -o "$FILENAME" export GOOS=linux export GOARCH=mipsle export FILENAME=artifacts/go2rtc_linux_mipsel go build -ldflags "-s -w" -trimpath -o "$FILENAME" export GOOS=darwin export GOARCH=amd64 go build -ldflags "-s -w" -trimpath -o go2rtc.amd64 export GOOS=darwin export GOARCH=arm64 go build -ldflags "-s -w" -trimpath -o go2rtc.arm64 export FILENAME=artifacts/go2rtc_mac_universal.zip lipo -output go2rtc -create go2rtc.arm64 go2rtc.amd64 && 7z a -mx9 -sdel "$FILENAME" go2rtc parallel --jobs $(nproc) "upx {}" ::: artifacts/go2rtc_linux_* - name: Setup tmate session uses: mxschmitt/action-tmate@v3 if: ${{ failure() }} - name: Set env run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Create GitHub release uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: files: artifacts/* generate_release_notes: true name: Release ${{ env.RELEASE_VERSION }} body_path: CHANGELOG.md draft: false prerelease: false