Change colour! #26
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
name: "Deploy Colormatic!" | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
# Fairly standard build and push. | |
build-and-push-docker: | |
name: Build and push Docker image | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
build-args: | | |
GITHUB_ACTIONS_RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
tags: | | |
ghcr.io/${{ github.repository }}/colormatic:latest | |
ghcr.io/${{ github.repository }}/colormatic:${{ github.sha }} | |
deploy-to-kubernetes: | |
name: Deploy Kubernetes manifests using Teleport and Kubectl | |
runs-on: ubuntu-latest | |
needs: build-and-push-docker | |
permissions: | |
id-token: write | |
contents: read | |
# As our join token specifies `environment: production`, the job | |
# also requires this. | |
environment: production | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Kubectl | |
uses: azure/setup-kubectl@v3 | |
- name: Install Teleport | |
uses: teleport-actions/setup@v1 | |
with: | |
version: 13.4.3 | |
- name: Authenticate with Teleport | |
# https://github.com/teleport-actions/auth-k8s | |
uses: teleport-actions/auth-k8s@v1 | |
with: | |
# Specify the publically accessible address of your Teleport proxy. | |
proxy: noah-demo.teleport.sh:443 | |
# Specify the name of the join token for your bot. | |
token: colormatic-deployer | |
# Specify the length of time that the generated credentials should be | |
# valid for. This is optional and defaults to "1h". | |
# Here we've limited it to 10m as this CI job doesn't need longer. | |
certificate-ttl: 10m | |
# Specify the name of the Kubernetes cluster the credentials will be | |
# generated for. | |
kubernetes-cluster: gcp | |
# Enable submission of anonymous usage telemetry to Teleport. | |
# See https://goteleport.com/docs/machine-id/reference/telemetry/ for | |
# more information. | |
anonymous-telemetry: 1 | |
- uses: azure/k8s-deploy@v4 | |
with: | |
namespace: 'colormatic' | |
annotate-namespace: false | |
manifests: | | |
kubernetes/99-deployment.yaml | |
kubernetes/99-service.yaml | |
images: 'ghcr.io/strideynet/machineid-github-kubernetes-webinar/colormatic:${{ github.sha }}' |