diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8cbd75..61d2cad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,12 @@ name: 'Build and Publish' on: workflow_dispatch: +env: + GAR_LOCATION: ${{ secrets.GAR_LOCATION }} + GAR_PROJECT_ID: ${{ secrets.GAR_PROJECT_ID }} + GAR_REPOSITORY: ${{ secrets.GAR_REPOSITORY }} + IMAGE_NAME: server + jobs: Build-Containers: runs-on: ubuntu-latest @@ -24,11 +30,19 @@ jobs: cache: 'sbt' - uses: sbt/setup-sbt@v1 - - name: Login to registry - run: echo ${{ secrets.TOKEN }} | docker login --username oauth --password-stdin cr.yandex + - name: Authenticate to Google Cloud + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_SA_KEY }} + + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@v2 + + - name: Configure Docker for Google Artifact Registry + run: | + gcloud auth configure-docker ${GAR_LOCATION}-docker.pkg.dev - - name: Push image + - name: Build and push image run: sbt pushImage - env: - SERVER_URL: ${{ secrets.SERVER_URL }} - REGISTRY: ${{ secrets.REGISTRY }} + env: + REGISTRY: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GAR_PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE_NAME }}