Hysteria2 (#11) #114
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: ["*"] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| REGISTRY: frknorg | |
| API_IMAGE_NAME: pony-api | |
| DOCKER_TAG: latest | |
| jobs: | |
| build-agent: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - aarch64-unknown-linux-gnu | |
| - armv7-unknown-linux-gnueabihf | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install latest rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| default: true | |
| override: true | |
| - name: Update apt package index | |
| run: sudo apt-get update | |
| - name: Install protobuf-compiler | |
| run: sudo apt-get install -y protobuf-compiler | |
| - name: Install zig | |
| run: pip3 install ziglang | |
| - name: Install cargo-zigbuild | |
| run: cargo install --locked cargo-zigbuild | |
| - name: Add target | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Build for ${{ matrix.target }} | |
| run: cargo zigbuild --release --target ${{ matrix.target }} --bin agent --no-default-features | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agent-${{ matrix.target }} | |
| path: target/${{ matrix.target }}/release/agent | |
| build-api: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install latest rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| default: true | |
| override: true | |
| - name: Update apt package index | |
| run: sudo apt-get update | |
| - name: Install protobuf-compiler | |
| run: sudo apt-get install -y protobuf-compiler | |
| - name: Build | |
| run: cargo build --release --no-default-features --bin api | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: api | |
| path: target/release/api | |
| release: | |
| name: Release | |
| needs: [build-api, build-agent] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download all agent artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| pattern: agent-* | |
| merge-multiple: false | |
| - name: Download API artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: api | |
| path: artifacts/api | |
| - name: Prepare release files | |
| run: | | |
| mkdir -p release | |
| cp artifacts/agent-x86_64-unknown-linux-gnu/agent release/agent-x86_64 | |
| cp artifacts/agent-aarch64-unknown-linux-gnu/agent release/agent-aarch64 | |
| cp artifacts/agent-armv7-unknown-linux-gnueabihf/agent release/agent-armv7 | |
| cp artifacts/api/api release/api-x86_64 | |
| chmod +x release/* | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: | | |
| release/api-x86_64 | |
| release/agent-x86_64 | |
| release/agent-aarch64 | |
| release/agent-armv7 | |
| deploy/init.sql | |
| deploy/install | |
| docs/* | |
| README.md | |
| config-agent-example.toml | |
| config-api-example.toml | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-api: | |
| name: Push Api Docker image (Multi-arch) | |
| needs: [release] | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| packages: write | |
| contents: read | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.REGISTRY }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ env.REGISTRY }}/${{ env.API_IMAGE_NAME }} | |
| - name: Build and push Docker images | |
| id: push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Dockerfile.api | |
| platforms: linux/amd64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |