ambient_proxy 0.3.5

NAT traversal proxy for Ambient game engine
Documentation
name: Release

on:
  push:
    tags: [v*]

jobs:
  publish-crate:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    env:
      CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo publish

  push-docker-image:
    name: Push tagged Docker release to Google Artifact Registry
    runs-on: ubuntu-latest

    permissions:
      contents: 'read'
      id-token: 'write'

    steps:
      - id: checkout
        name: Checkout
        uses: actions/checkout@v3

      - id: auth
        name: Authenticate with Google Cloud
        uses: google-github-actions/auth@v0
        with:
          token_format: access_token
          workload_identity_provider: projects/549180905870/locations/global/workloadIdentityPools/github-pool/providers/github-provider
          service_account: github@ambient-733e7.iam.gserviceaccount.com
          access_token_lifetime: 600s

      - name: Login to Artifact Registry
        uses: docker/login-action@v1
        with:
          registry: europe-west1-docker.pkg.dev
          username: oauth2accesstoken
          password: ${{ steps.auth.outputs.access_token }}

      - name: Get version from tag
        id: get-version
        # get the version number from ref (example: GIHUB_REF = refs/tags/v1.2.3 -> 1.2.3)
        run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

      # Note: it's crucial to push the commit first and then the tag referencing it. Doing it at the same time will cause failure in this step
      # Issue: https://github.com/docker/build-push-action/issues/627#issuecomment-1396108641
      - id: docker-push-tagged
        name: Tag Docker image and push to Google Artifact Registry
        uses: docker/build-push-action@v4
        with:
          context: .
          push: true
          tags: |
             europe-west1-docker.pkg.dev/ambient-733e7/ambient/ambient-proxy:${{ steps.get-version.outputs.version }}
             europe-west1-docker.pkg.dev/ambient-733e7/ambient/ambient-proxy:latest