diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index 3b298598..0f354e5e 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -10,21 +10,45 @@ # # For more support on how to run the workflow, please visit https://github.com/google-github-actions/setup-gcloud/tree/master/example-workflows/gke-kustomize -name: Build and Deploy to GCP registry +name: Release(tag), Build and push to GCP registry on: push: branches: [ "split", "master" ] +permissions: + contents: write + pull-requests: write + env: GAR_LOCATION: asia-northeast1 # TODO: update region of the Artifact Registry IMAGE: shibuya jobs: - setup-build-publish-deploy: - name: Setup, Build, Publish + release-please: + name: release-please + runs-on: ubuntu-20.04 + outputs: + tag_name: ${{ steps.create_release.outputs.tag_name }} + steps: + - uses: googleapis/release-please-action@v4 + id: create_release + with: + # this assumes that you have created a personal access token + # (PAT) and configured it as a GitHub action secret named + # `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important). + token: ${{ secrets.GITHUB_TOKEN }} + # this is a built-in strategy in release-please, see "Action Inputs" + # for more options + release-type: simple + + + setup-build-publish-push: + needs: release-please + name: Setup, Build, push runs-on: ubuntu-20.04 environment: production + if: ${{ needs.release-please.outputs.tag_name != '' }} steps: - name: Checkout @@ -49,10 +73,14 @@ jobs: # Build the Docker image - name: Build api + env: + tag_name: ${{ needs.release-please.outputs.tag_name }} run: |- cd shibuya && make api_image component=api - name: Build controller + env: + tag_name: ${{ needs.release-please.outputs.tag_name }} run: |- cd shibuya && make controller_image component=controller diff --git a/shibuya/Makefile b/shibuya/Makefile index a52a9630..4b80fcfd 100644 --- a/shibuya/Makefile +++ b/shibuya/Makefile @@ -1,7 +1,14 @@ registry=$(GAR_LOCATION)-docker.pkg.dev/$(GCP_PROJECT) repository = shibuya -tag=$(GITHUB_SHA) +tag=$(tag_name) img=$(registry)/$(repository)/$(component):$(tag) +upstream = rakutentech + +ifeq ($(GITHUB_REPOSITORY_OWNER), $(upstream)) + tag=$(tag_name) +else + tag=$(GITHUB_REPOSITORY_OWNER)-$(tag_name) +endif .PHONY: api_build api_build: diff --git a/shibuya/install/shibuya/Chart.yaml b/shibuya/install/shibuya/Chart.yaml index 86aba700..a9776b2c 100644 --- a/shibuya/install/shibuya/Chart.yaml +++ b/shibuya/install/shibuya/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 +version: chart-v0.1.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to