Skip to content

fix(Docs): Updated docs to include that changes to k8s files will tri… #32

fix(Docs): Updated docs to include that changes to k8s files will tri…

fix(Docs): Updated docs to include that changes to k8s files will tri… #32

Workflow file for this run

name: Release
on:
push:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
frontend: ${{ steps.changes.outputs.frontend }}
backend: ${{ steps.changes.outputs.backend }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
frontend:
- 'frontend/**'
- 'k8s/frontend/**'
backend:
- 'backend/**'
- 'k8s/backend/**'
semantic-realease:
name: Semantic release
environment: Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "npm"
- name: Install dependencies
run: npm clean-install --force
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
run: npx semantic-release >> semantic-release.log
- name: Archive release log
uses: actions/upload-artifact@v3
with:
name: semantic-release.log
path: semantic-release.log
- name: Get version
id: version
run: echo version=$(cat semantic-release.log | grep -oP "next release version is \K.*") >> $GITHUB_OUTPUT
build-frontend:
name: Build frontend
permissions:
contents: read
packages: write
id-token: write
needs:
- changes
- semantic-realease
if: (needs.changes.outputs.frontend == 'true' && needs.semantic-realease.outputs.version != '')
uses: ./.github/workflows/build.yml
with:
workspace: frontend
tags: |
type=raw,value=frontend-latest
type=raw,value=frontend-${{ github.sha }}
type=semver,pattern=frontend-{{major}},value=${{ needs.semantic-realease.outputs.version }}
type=semver,pattern=frontend-{{major}}.{{minor}},value=${{ needs.semantic-realease.outputs.version }}
type=semver,pattern=frontend-{{version}},value=${{ needs.semantic-realease.outputs.version }}
build-backend:
name: Build backend
permissions:
contents: read
packages: write
id-token: write
needs:
- changes
- semantic-realease
if: (needs.changes.outputs.backend == 'true' && needs.semantic-realease.outputs.version != '')
uses: ./.github/workflows/build.yml
with:
workspace: backend
tags: |
type=raw,value=backend-latest
type=raw,value=backend-${{ github.sha }}
type=semver,pattern=backend-{{major}},value=${{ needs.semantic-realease.outputs.version }}
type=semver,pattern=backend-{{major}}.{{minor}},value=${{ needs.semantic-realease.outputs.version }}
type=semver,pattern=backend-{{version}},value=${{ needs.semantic-realease.outputs.version }}
deploy-frontend:
name: Deploy frontend
runs-on: ubuntu-latest
needs:
- build-frontend
- semantic-realease
if: needs.build-frontend.result == 'success'
environment: Deploy
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup kubectl
run: echo "${{ secrets.KUBECONFIG }}" | base64 -d > kubeconfig
- name: Deploy to cluster
run: kubectl --kubeconfig kubeconfig apply -f ./k8s/frontend
- name: Deploy to cluster
run: kubectl --kubeconfig kubeconfig set image deployment/frontend frontend=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:frontend-${{ needs.semantic-realease.outputs.version }}
- name: Verify deployment
run: kubectl --kubeconfig kubeconfig rollout status deployment/frontend
deploy-backend:
name: Deploy backend
runs-on: ubuntu-latest
needs:
- build-backend
- semantic-realease
if: needs.build-backend.result == 'success'
environment: Deploy
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup kubectl
run: echo "${{ secrets.KUBECONFIG }}" | base64 -d > kubeconfig
- name: Deploy to cluster
run: kubectl --kubeconfig kubeconfig apply -f ./k8s/backend
- name: Deploy to cluster
run: kubectl --kubeconfig kubeconfig set image deployment/backend backend=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:backend-${{ needs.semantic-realease.outputs.version }}
- name: Verify deployment
run: kubectl --kubeconfig kubeconfig rollout status deployment/backend