You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/publish.yml
+25-1Lines changed: 25 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -30,13 +30,23 @@ jobs:
30
30
registry: ${{ env.REGISTRY }}
31
31
username: ${{ github.actor }}
32
32
password: ${{ secrets.GITHUB_TOKEN }}
33
+
34
+
# Install DO CLI
35
+
- name: Install doctl
36
+
uses: digitalocean/action-doctl@v2
37
+
with:
38
+
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
39
+
40
+
- name: Log in to DigitalOcean Container Registry with short-lived credentials
41
+
run: doctl registry login --expiry-seconds 1200
42
+
33
43
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
34
44
- name: Extract metadata (tags, labels) for Docker
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
49
+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages and the DO registry for k8s.
40
50
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
41
51
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
42
52
- name: Build and push Docker image
@@ -46,3 +56,17 @@ jobs:
46
56
push: true
47
57
tags: ${{ steps.meta.outputs.tags }}
48
58
labels: ${{ steps.meta.outputs.labels }}
59
+
60
+
deploy-to-cluster:
61
+
steps:
62
+
- name: Update deployment file
63
+
run: TAG=$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|${{ secrets.REGISTRY_NAME }}/${{ env.IMAGE_NAME }}:'${TAG}'|' $GITHUB_WORKSPACE/config/deployment.yml
64
+
65
+
- name: Save DigitalOcean kubeconfig with short-lived credentials
0 commit comments