Skip to content

Commit

Permalink
Push image to Artifact Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
jskeet committed Feb 19, 2024
1 parent 92184ca commit 6c149f3
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ jobs:
build-docs:
runs-on: ubuntu-latest
env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
DOTNET_NOLOGO: true
GKE_CLUSTER: web-cluster
GKE_ZONE: us-central1-a
REPOSITORY_ZONE: us-central1
REPOSITORY_NAME: nodatime-org
DEPLOYMENT_NAME: nodatime-test
IMAGE: nodatime.org

steps:
- name: Check out nodatime.org
Expand All @@ -26,8 +33,41 @@ jobs:
repository: nodatime/nodatime.serialization
path: nodatime.serialization

- name: Set up Google auth
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GKE_SA_KEY }}"

- name: "Set up gcloud"
uses: "google-github-actions/setup-gcloud@v2"

- name: "Configure Docker auth"
run: |-
gcloud auth configure-docker ${REPOSITORY_ZONE}-docker.pkg.dev --quiet
- name "Construct the image tag"
run: |-
echo "IMAGE_TAG=${REPOSITORY_ZONE}-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:$GITHUB_RUN_ID" >> $GITHUB_ENV
# Note: we don't use GITHUB_SHA in the tag, as we have
# potentially three different relevant commits.
- name: Docker build
run: |-
docker build \
--tag $IMAGE_TAG \
-f nodatime.org/build/Dockerfile \
.
.
# Push the Docker image to Google Artifact Registry
- name: Publish
run: |-
docker push $IMAGE_TAG
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@db150f2cc60d1716e61922b832eae71d2a45938f
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

# TODO: Update the (test) deployment

0 comments on commit 6c149f3

Please sign in to comment.