Bump to v0.3.0 #8
Workflow file for this run
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: CD Workflow | |
on: | |
push: | |
tags: | |
- '*' | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build | |
uses: docker/bake-action@v4 | |
with: | |
files: docker-bake.hcl | |
load: true | |
set: | | |
*.cache-from=type=gha | |
*.cache-to=type=gha,mode=max | |
- name: Set up ID token | |
uses: actions/github-script@v7 | |
id: id-token | |
with: | |
result-encoding: string | |
script: | | |
return await core.getIDToken('container.chitoku.jp'); | |
- name: Log into Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: container.chitoku.jp | |
username: oidc-idtoken | |
password: ${{ steps.id-token.outputs.result }} | |
- name: Push to Container Registry | |
run: | | |
docker push container.chitoku.jp/chitoku-k/hoarder/api | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- name: Set up kubectl | |
uses: azure/setup-kubectl@v4 | |
- name: Set up ID token | |
uses: actions/github-script@v7 | |
id: id-token | |
with: | |
result-encoding: string | |
script: | | |
return await core.getIDToken('k8s.chitoku.jp'); | |
- name: Set context | |
run: | | |
kubectl config set-cluster k8s.chitoku.jp --server=https://k8s.chitoku.jp | |
kubectl config set-credentials github-actions --token=${{ steps.id-token.outputs.result }} | |
kubectl config set-context k8s.chitoku.jp --cluster=k8s.chitoku.jp --user=github-actions | |
kubectl config use-context k8s.chitoku.jp | |
- name: Rollout restart | |
run: | | |
kubectl rollout restart deployment/hoarder-api |