Skip to content

Commit

Permalink
Merge pull request #109 from iandyh/actions
Browse files Browse the repository at this point in the history
Better release pipelines
  • Loading branch information
iandyh committed Jul 12, 2024
2 parents a3e0cd3 + c38a4bb commit 642ec3b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion shibuya/Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion shibuya/install/shibuya/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 642ec3b

Please sign in to comment.