From 617fb89ca535a114f611b12da98516e5e66c9202 Mon Sep 17 00:00:00 2001 From: Igor Gov Date: Mon, 14 Mar 2022 13:15:28 +0200 Subject: [PATCH] Build custom branch Github action (#890) * Build custom branch github action #build_and_publish_custom_image * #build_and_publish_custom_image * #build_and_publish_custom_image * #build_and_publish_custom_image * #build_and_publish_custom_image * #build_and_publish_custom_image * . --- .github/workflows/build-custom-branch.yml | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/build-custom-branch.yml diff --git a/.github/workflows/build-custom-branch.yml b/.github/workflows/build-custom-branch.yml new file mode 100644 index 000000000..f26059863 --- /dev/null +++ b/.github/workflows/build-custom-branch.yml @@ -0,0 +1,44 @@ +name: Build Custom Branch + +on: push + +concurrency: + group: custom-branch-build-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Push custom branch image to GCR + runs-on: ubuntu-latest + if: ${{ contains(github.event.head_commit.message, '#build_and_publish_custom_image') }} + + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - id: 'auth' + uses: 'google-github-actions/auth@v0' + with: + credentials_json: '${{ secrets.GCR_JSON_KEY }}' + + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v0' + + - name: Get base image name + shell: bash + run: echo "##[set-output name=image;]$(echo gcr.io/up9-docker-hub/mizu/${GITHUB_REF#refs/heads/})" + id: base_image_step + + - name: Login to GCR + uses: docker/login-action@v1 + with: + registry: gcr.io + username: _json_key + password: ${{ secrets.GCR_JSON_KEY }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.base_image_step.outputs.image }}:latest \ No newline at end of file