-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add github action ci for docker image builds (#2)
- Loading branch information
1 parent
4741e95
commit 4137a0a
Showing
4 changed files
with
1,970 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- '**' | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Set tag & repo name for PR builds | ||
if: ${{ !contains(fromJson('["refs/heads/master" ]'), github.ref) }} | ||
run: | | ||
echo "IMAGE_TAG=PR-${{ github.event.number }}" >> $GITHUB_ENV | ||
echo "REPO=deepsource-dev" >> $GITHUB_ENV | ||
- name: Set tag & repo name for master builds | ||
if: contains(fromJson('["refs/heads/master"]'), github.ref) | ||
run: | | ||
echo "IMAGE_TAG=master" >> $GITHUB_ENV | ||
echo "REPO=deepsource-dev" >> $GITHUB_ENV | ||
- name: Set tag & repo name for releases | ||
if: startsWith(github.event.ref, 'refs/tags/v') | ||
run: | | ||
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV | ||
echo "REPO=deepsource-production" >> $GITHUB_ENV | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Authenticate to Google Cloud Development | ||
if: ${{ !startsWith(github.event.ref, 'refs/tags/v') }} | ||
uses: "google-github-actions/auth@v1" | ||
with: | ||
credentials_json: "${{ secrets.DS_GHA_SA_DEV }}" | ||
|
||
- name: Authenticate to Google Cloud Production | ||
if: startsWith(github.event.ref, 'refs/tags/v') | ||
uses: "google-github-actions/auth@v1" | ||
with: | ||
credentials_json: "${{ secrets.DS_GHA_SA_PROD }}" | ||
|
||
- name: Set up Cloud SDK | ||
uses: "google-github-actions/setup-gcloud@v1" | ||
|
||
- name: Configure docker for gcr | ||
run: | | ||
gcloud auth configure-docker | ||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: us.gcr.io/${{ env.REPO }}/runner:${{ env.IMAGE_TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
bin/** | ||
**/config.yaml | ||
|
||
go.sum | ||
|
||
# Others | ||
.DS_Store | ||
.vscode/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.