name: Build aether-proxy on: push: tags: ['proxy-v*'] workflow_dispatch: permissions: contents: write concurrency: group: build-proxy-${{ github.ref }} cancel-in-progress: false jobs: preflight: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v5 - name: Ensure proxy tag matches Cargo version shell: bash run: | TAG="${GITHUB_REF_NAME}" EXPECTED="${TAG#proxy-v}" ACTUAL="$(cargo metadata --manifest-path apps/aether-proxy/Cargo.toml --locked --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "aether-proxy") | .version')" echo "tag version: ${EXPECTED}" echo "cargo version: ${ACTUAL}" if [ -z "${ACTUAL}" ]; then echo "Could not resolve aether-proxy package version" >&2 exit 1 fi if [ "${EXPECTED}" != "${ACTUAL}" ]; then echo "proxy tag ${TAG} does not match apps/aether-proxy/Cargo.toml version ${ACTUAL}" >&2 exit 1 fi build: needs: preflight if: always() && (needs.preflight.result == 'success' || needs.preflight.result == 'skipped') name: ${{ matrix.name }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - name: linux-amd64 target: x86_64-unknown-linux-gnu os: ubuntu-latest use_cross: true - name: linux-arm64 target: aarch64-unknown-linux-gnu os: ubuntu-latest use_cross: true - name: linux-musl-amd64 target: x86_64-unknown-linux-musl os: ubuntu-latest use_cross: true - name: linux-musl-arm64 target: aarch64-unknown-linux-musl os: ubuntu-latest use_cross: true - name: macos-amd64 target: x86_64-apple-darwin os: macos-15-intel use_cross: false - name: macos-arm64 target: aarch64-apple-darwin os: macos-15 use_cross: false - name: windows-amd64 target: x86_64-pc-windows-msvc os: windows-latest use_cross: false steps: - uses: actions/checkout@v5 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Ensure Rust target is installed run: rustup target add ${{ matrix.target }} - name: Rust cache uses: Swatinem/rust-cache@v2 with: workspaces: apps/aether-proxy -> target key: ${{ matrix.target }} - name: Install cross if: matrix.use_cross uses: taiki-e/install-action@cross - name: Build working-directory: apps/aether-proxy shell: bash run: | if [ "${{ matrix.use_cross }}" = "true" ]; then cross build --release --target ${{ matrix.target }} else cargo build --release --target ${{ matrix.target }} fi - name: Package (Unix) if: runner.os != 'Windows' shell: bash run: | cd target/${{ matrix.target }}/release chmod +x aether-proxy tar czf ../../../aether-proxy-${{ matrix.name }}.tar.gz aether-proxy - name: Package (Windows) if: runner.os == 'Windows' shell: bash run: | cd target/${{ matrix.target }}/release 7z a ../../../aether-proxy-${{ matrix.name }}.zip aether-proxy.exe - name: Upload artifact uses: actions/upload-artifact@v5 with: name: aether-proxy-${{ matrix.name }} path: | aether-proxy-*.tar.gz aether-proxy-*.zip if-no-files-found: error release: needs: build runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: - name: Download all artifacts uses: actions/download-artifact@v5 with: merge-multiple: true path: artifacts - name: Generate checksums working-directory: artifacts run: sha256sum aether-proxy-* > SHA256SUMS.txt - name: Delete stale draft releases for tag env: GH_TOKEN: ${{ github.token }} RELEASE_TAG: ${{ github.ref_name }} REPOSITORY: ${{ github.repository }} shell: bash run: | set -euo pipefail draft_ids="$(gh api "repos/${REPOSITORY}/releases" --paginate --jq '.[] | select(.tag_name == env.RELEASE_TAG and .draft == true) | .id')" if [[ -z "${draft_ids}" ]]; then echo "No stale draft releases for ${RELEASE_TAG}" exit 0 fi while IFS= read -r release_id; do [[ -z "${release_id}" ]] && continue echo "Deleting stale draft release ${release_id} for ${RELEASE_TAG}" gh api -X DELETE "repos/${REPOSITORY}/releases/${release_id}" done <<< "${draft_ids}" - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: name: "${{ github.ref_name }}" generate_release_notes: true files: | artifacts/aether-proxy-* artifacts/SHA256SUMS.txt fail_on_unmatched_files: true update-readme: needs: release runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v5 with: ref: aether-rust-pioneer - name: Update README download links env: TAG: ${{ github.ref_name }} run: | VERSION="${TAG#proxy-v}" BASE="https://github.com/fawney19/Aether/releases/download/${TAG}" if [ -d apps/aether-proxy ]; then PROXY_DIR="apps/aether-proxy" else PROXY_DIR="aether-proxy" fi cd "$PROXY_DIR" TABLE="| Platform | Download |\n|----------|----------|\n" TABLE+="| Linux x86_64 (GNU) | [aether-proxy-linux-amd64.tar.gz](${BASE}/aether-proxy-linux-amd64.tar.gz) |\n" TABLE+="| Linux ARM64 (GNU) | [aether-proxy-linux-arm64.tar.gz](${BASE}/aether-proxy-linux-arm64.tar.gz) |\n" TABLE+="| Linux x86_64 (musl) | [aether-proxy-linux-musl-amd64.tar.gz](${BASE}/aether-proxy-linux-musl-amd64.tar.gz) |\n" TABLE+="| Linux ARM64 (musl) | [aether-proxy-linux-musl-arm64.tar.gz](${BASE}/aether-proxy-linux-musl-arm64.tar.gz) |\n" TABLE+="| macOS x86_64 | [aether-proxy-macos-amd64.tar.gz](${BASE}/aether-proxy-macos-amd64.tar.gz) |\n" TABLE+="| macOS ARM64 | [aether-proxy-macos-arm64.tar.gz](${BASE}/aether-proxy-macos-arm64.tar.gz) |\n" TABLE+="| Windows x86_64 | [aether-proxy-windows-amd64.zip](${BASE}/aether-proxy-windows-amd64.zip) |" # Replace content between markers if grep -q '' README.md; then awk -v table="$TABLE" ' // { print; printf "%s\n", table; skip=1; next } // { skip=0 } !skip { print } ' README.md > README.tmp && mv README.tmp README.md fi - name: Commit and push run: | if [ -d apps/aether-proxy ]; then PROXY_DIR="apps/aether-proxy" else PROXY_DIR="aether-proxy" fi cd "$PROXY_DIR" git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add README.md git diff --cached --quiet && exit 0 TAG="${GITHUB_REF#refs/tags/}" git commit -m "chore(proxy): update download links for ${TAG}" git push