|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ["v*"] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write # create the GitHub release |
| 9 | + packages: write # push images to GHCR |
| 10 | + |
| 11 | +env: |
| 12 | + CGO_LDFLAGS: -L${{ github.workspace }}/lib |
| 13 | + |
| 14 | +jobs: |
| 15 | + binaries: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 19 | + |
| 20 | + - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 |
| 21 | + with: |
| 22 | + go-version: "1.24" |
| 23 | + cache: true |
| 24 | + |
| 25 | + - name: Build binaries and fetch ONNX Runtime |
| 26 | + run: make build libonnxruntime VERSION=${{ github.ref_name }} |
| 27 | + |
| 28 | + - name: Package (linux-amd64) |
| 29 | + run: | |
| 30 | + version="${GITHUB_REF_NAME}" |
| 31 | + name="piguard-${version}-linux-amd64" |
| 32 | + mkdir -p "dist/${name}" |
| 33 | + cp bin/piguard bin/piguard-server lib/libonnxruntime.so README.md LICENSE "dist/${name}/" |
| 34 | + tar -C dist -czf "${name}.tar.gz" "${name}" |
| 35 | + sha256sum "${name}.tar.gz" > "${name}.tar.gz.sha256" |
| 36 | +
|
| 37 | + - name: Create release |
| 38 | + uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2 |
| 39 | + with: |
| 40 | + generate_release_notes: true |
| 41 | + files: | |
| 42 | + piguard-*-linux-amd64.tar.gz |
| 43 | + piguard-*-linux-amd64.tar.gz.sha256 |
| 44 | +
|
| 45 | + images: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 49 | + |
| 50 | + - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 |
| 51 | + |
| 52 | + - name: Log in to GHCR |
| 53 | + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 |
| 54 | + with: |
| 55 | + registry: ghcr.io |
| 56 | + username: ${{ github.actor }} |
| 57 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + |
| 59 | + - name: Metadata (server) |
| 60 | + id: meta_server |
| 61 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5 |
| 62 | + with: |
| 63 | + images: ghcr.io/${{ github.repository }} |
| 64 | + tags: | |
| 65 | + type=semver,pattern={{version}} |
| 66 | + type=semver,pattern={{major}}.{{minor}} |
| 67 | +
|
| 68 | + - name: Build and push server image |
| 69 | + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 |
| 70 | + with: |
| 71 | + context: . |
| 72 | + push: true |
| 73 | + tags: ${{ steps.meta_server.outputs.tags }} |
| 74 | + labels: ${{ steps.meta_server.outputs.labels }} |
| 75 | + |
| 76 | + - name: Metadata (gateway) |
| 77 | + id: meta_gateway |
| 78 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5 |
| 79 | + with: |
| 80 | + images: ghcr.io/${{ github.repository }}-gateway |
| 81 | + tags: | |
| 82 | + type=semver,pattern={{version}} |
| 83 | + type=semver,pattern={{major}}.{{minor}} |
| 84 | +
|
| 85 | + - name: Build and push gateway image |
| 86 | + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 |
| 87 | + with: |
| 88 | + context: . |
| 89 | + file: examples/http-gateway/Dockerfile |
| 90 | + push: true |
| 91 | + tags: ${{ steps.meta_gateway.outputs.tags }} |
| 92 | + labels: ${{ steps.meta_gateway.outputs.labels }} |
0 commit comments