feat: Apply iptable rules on startup #3
Workflow file for this run
This file contains hidden or 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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| use_zig: false | |
| suffix: x86_64-linux | |
| - target: aarch64-unknown-linux-gnu | |
| use_zig: true | |
| zig_target: aarch64-unknown-linux-gnu.2.31 | |
| suffix: aarch64-linux | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| - name: Extract short SHA | |
| id: vars | |
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| - name: Install Rust Toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install Zig Toolchain | |
| if: ${{ matrix.use_zig }} | |
| uses: mlugg/setup-zig@v2 | |
| - name: Install cargo-zigbuild | |
| if: ${{ matrix.use_zig }} | |
| run: cargo install cargo-zigbuild | |
| - name: Build x86 (Native) | |
| if: ${{ !matrix.use_zig }} | |
| run: cargo build --release --target ${{ matrix.target }} | |
| env: | |
| CURRENT_COMMIT: ${{ steps.vars.outputs.sha_short }} | |
| CURRENT_BUILD: ${{ github.run_number }} | |
| - name: Build ARM (Debian 11 / glibc 2.31) | |
| if: ${{ matrix.use_zig }} | |
| run: cargo zigbuild --release --target ${{ matrix.zig_target }} | |
| env: | |
| CURRENT_COMMIT: ${{ steps.vars.outputs.sha_short }} | |
| CURRENT_BUILD: ${{ github.run_number }} | |
| - name: Prepare Binary for Upload | |
| shell: bash | |
| run: | | |
| BIN_NAME="ubitix" | |
| if [[ "${{ matrix.use_zig }}" == "true" ]]; then | |
| BIN_PATH="target/${{ matrix.target }}/release/$BIN_NAME" | |
| else | |
| BIN_PATH="target/${{ matrix.target }}/release/$BIN_NAME" | |
| fi | |
| mkdir -p dist | |
| cp "$BIN_PATH" "dist/$BIN_NAME-${{ matrix.suffix }}" | |
| - name: Upload Temp Artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: binary-${{ matrix.suffix }} | |
| path: dist/* | |
| retention-days: 1 | |
| create-release: | |
| name: Create Draft Release | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: release-assets/ | |
| merge-multiple: true | |
| - name: Create Draft Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }} | |
| files: | | |
| release-assets/* | |
| ubitix.service |