v0.5.24: detect pacman/zypper/apk in setup.sh #8
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: Publish Docker Image | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'Cargo.toml' | |
| - 'src/**' | |
| - 'docker/**' | |
| - '.github/workflows/docker-publish.yml' | |
| workflow_dispatch: | |
| jobs: | |
| build-binaries: | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-musl | |
| arch: amd64 | |
| runner: ubuntu-latest | |
| - target: aarch64-unknown-linux-musl | |
| arch: arm64 | |
| runner: ubuntu-latest | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build static binaries | |
| run: cross build --release --target ${{ matrix.target }} | |
| - name: Stage binaries | |
| run: | | |
| mkdir -p dist/${{ matrix.arch }} | |
| cp target/${{ matrix.target }}/release/wolfnet dist/${{ matrix.arch }}/wolfnet | |
| cp target/${{ matrix.target }}/release/wolfnetctl dist/${{ matrix.arch }}/wolfnetctl | |
| chmod +x dist/${{ matrix.arch }}/wolfnet dist/${{ matrix.arch }}/wolfnetctl | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries-${{ matrix.arch }} | |
| path: dist/${{ matrix.arch }}/ | |
| publish: | |
| needs: build-binaries | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version | |
| id: version | |
| run: echo "version=$(grep '^version' Cargo.toml | head -1 | sed 's/.*\"\(.*\)\".*/\1/')" >> "$GITHUB_OUTPUT" | |
| - name: Download amd64 binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: binaries-amd64 | |
| path: dist/amd64 | |
| - name: Download arm64 binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: binaries-arm64 | |
| path: dist/arm64 | |
| - name: Ensure binaries are executable | |
| run: chmod +x dist/amd64/* dist/arm64/* | |
| - 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 GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push multi-arch image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: docker/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ghcr.io/wolfsoftwaresystemsltd/wolfnet:latest | |
| ghcr.io/wolfsoftwaresystemsltd/wolfnet:${{ steps.version.outputs.version }} |