-
Notifications
You must be signed in to change notification settings - Fork 4
Add build yaml #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add build yaml #119
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
165cff6
add build yaml
45930 e72a252
typo
45930 c2754bd
update tags
45930 5d21bdf
add tags to output
45930 74851c0
Merge branch 'main' into 2025-04-add-build-yaml
45930 59232b8
Complying with Docker suggestion about casing: (#122)
SanabriaRusso 3b69ce2
Adding shorter tags to dev- artifacts: (#123)
SanabriaRusso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,66 @@ | ||
name: Docker Build CI/CD | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | ||
GAR_LOCATION: asia-northeast3 | ||
PROJECT_ID: o1labs-192920 | ||
REGISTRY: gitops-images | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Checkout PR branch | ||
run: | | ||
git fetch origin ${{github.event.pull_request.head.ref}} | ||
git checkout ${{github.event.pull_request.head.sha}} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
|
||
- name: Authenticate to Google Cloud | ||
uses: google-github-actions/[email protected] | ||
with: | ||
credentials_json: ${{ env.GCP_SA_KEY }} | ||
|
||
- name: Configure Docker for Artifact Registry | ||
run: | | ||
gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev | ||
|
||
- name: Determine tags | ||
id: determine_tags | ||
run: | | ||
TAGS="${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REGISTRY }}/dev-${{ github.sha }}" | ||
echo "tags=$TAGS" >> $GITHUB_OUTPUT | ||
|
||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.determine_tags.outputs.tags }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | ||
|
||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.