name: Release on: push: tags: - "*" jobs: build: runs-on: ubuntu-latest steps: - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} - uses: actions/checkout@v3 - uses: mlugg/setup-zig@v1 with: version: 0.10.1 - uses: hecrj/setup-rust-action@master with: rust-version: stable - name: Check Cargo availability run: cargo --version - name: Check Rustup default toolchain run: rustup default | grep stable - name: Install cargo-deb run: cargo install cargo-deb - name: Install cargo-generate-rpm run: cargo install cargo-generate-rpm - name: Install cargo-zigbuild run: cargo install cargo-zigbuild - name: Release build Linux-x86-64 run: | rustup target add x86_64-unknown-linux-musl env RUSTFLAGS="-C strip=symbols" cargo zigbuild --release --target x86_64-unknown-linux-musl mkdir doh-proxy mv target/x86_64-unknown-linux-musl/release/doh-proxy doh-proxy/ cp README.md localhost.pem doh-proxy/ tar cJpf doh-proxy_${{ steps.get_version.outputs.VERSION }}_linux-x86_64.tar.bz2 doh-proxy rm -fr doh-proxy - name: Release build Linux-aarch64 run: | rustup target add aarch64-unknown-linux-musl env RUSTFLAGS="-C strip=symbols" cargo zigbuild --release --target aarch64-unknown-linux-musl mkdir doh-proxy mv target/aarch64-unknown-linux-musl/release/doh-proxy doh-proxy/ cp README.md localhost.pem doh-proxy/ tar cJpf doh-proxy_${{ steps.get_version.outputs.VERSION }}_linux-aarch64.tar.bz2 doh-proxy rm -fr doh-proxy - name: Release build Windows-x86_64 run: | rustup target add x86_64-pc-windows-gnu env RUSTFLAGS="-C strip=symbols" cargo zigbuild --release --target x86_64-pc-windows-gnu mkdir doh-proxy mv target/x86_64-pc-windows-gnu/release/doh-proxy.exe doh-proxy/ cp README.md localhost.pem doh-proxy/ zip -9 -r doh-proxy_${{ steps.get_version.outputs.VERSION }}_windows-x86_64.zip doh-proxy rm -fr doh-proxy - name: Debian packages run: | rustup target add x86_64-unknown-linux-musl env RUSTFLAGS="-C strip=symbols" cargo deb --no-strip --cargo-build=zigbuild --target=x86_64-unknown-linux-musl rustup target add aarch64-unknown-linux-musl env RUSTFLAGS="-C strip=symbols" cargo deb --no-strip --cargo-build=zigbuild --target=aarch64-unknown-linux-musl - name: RPM packages run: | rustup target add x86_64-unknown-linux-gnu env RUSTFLAGS="-C strip=symbols" cargo-zigbuild build --target=x86_64-unknown-linux-gnu.2.17 --release mv target/x86_64-unknown-linux-musl/release/doh-proxy target/release/ cargo generate-rpm --target x86_64-unknown-linux-gnu rustup target add aarch64-unknown-linux-gnu env RUSTFLAGS="-C strip=symbols" cargo-zigbuild build --target=aarch64-unknown-linux-gnu.2.17 --release cargo generate-rpm --target aarch64-unknown-linux-gnu - name: Create release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} draft: true prerelease: false - name: Upload Debian package for x86_64 id: upload-release-asset-debian-x86_64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_name: "doh-proxy_${{ steps.get_version.outputs.VERSION }}-1_amd64.deb" asset_path: "target/x86_64-unknown-linux-musl/debian/doh-proxy_${{ steps.get_version.outputs.VERSION }}-1_amd64.deb" asset_content_type: application/x-debian-package - name: Upload RPM package for x86_64 id: upload-release-asset-rpm-x86_64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_name: "doh-proxy-${{ steps.get_version.outputs.VERSION }}-1.x86_64.rpm" asset_path: "target/x86_64-unknown-linux-gnu/generate-rpm/doh-proxy-${{ steps.get_version.outputs.VERSION }}-1.x86_64.rpm" asset_content_type: application/x-redhat-package-manager - name: Upload RPM package for aarch64 id: upload-release-asset-rpm-aarch64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_name: "doh-proxy-${{ steps.get_version.outputs.VERSION }}-1.aarch64.rpm" asset_path: "target/aarch64-unknown-linux-gnu/generate-rpm/doh-proxy-${{ steps.get_version.outputs.VERSION }}-1.aarch64.rpm" asset_content_type: application/x-redhat-package-manager - name: Upload tarball for linux-x86_64 id: upload-release-asset-tarball-linux-x86_64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_name: "doh-proxy_${{ steps.get_version.outputs.VERSION }}_linux-x86_64.tar.bz2" asset_path: "doh-proxy_${{ steps.get_version.outputs.VERSION }}_linux-x86_64.tar.bz2" asset_content_type: application/x-tar - name: Upload tarball for linux-aarch64 id: upload-release-asset-tarball-linux-aarch64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_name: "doh-proxy_${{ steps.get_version.outputs.VERSION }}_linux-aarch64.tar.bz2" asset_path: "doh-proxy_${{ steps.get_version.outputs.VERSION }}_linux-aarch64.tar.bz2" asset_content_type: application/x-tar - name: Upload tarball for windows-x86_64 id: upload-release-asset-tarball-windows-x86_64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_name: "doh-proxy_${{ steps.get_version.outputs.VERSION }}_windows-x86_64.zip" asset_path: "doh-proxy_${{ steps.get_version.outputs.VERSION }}_windows-x86_64.zip" asset_content_type: application/zip