Skip to content

docs: Add project description #9

docs: Add project description

docs: Add project description #9

name: Service CI/CD Pipeline to Release and Deploy to Dev Env
on:
push:
branches:
- main
jobs:
release:
name: build docker image
runs-on: ubuntu-latest
if: |
!contains(github.event.head_commit.message, 'skip-ci')
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: yarn clean install
run: yarn install --frozen-lockfile
- run: yarn global add semantic-release @semantic-release/{git,exec,changelog}
- run: semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: make build
run: yarn build
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build snapshot and push on merge
id: docker_build_release
uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile
push: true
tags: greenstand/treetracker-like:${{ steps.package-version.outputs.current-version }}
outputs:
bumped_version: ${{ steps.package-version.outputs.current-version }}
deploy:
name: Deploy to dev env
runs-on: ubuntu-latest
needs: release
if: |
!contains(github.event.head_commit.message, 'skip-ci')
steps:
- uses: actions/checkout@v2
- name: Install kustomize
run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
- name: Run kustomize
run: (cd deployment/base && ../../kustomize edit set image greenstand/treetracker-like:${{ needs.release.outputs.bumped_version }} )
- name: Install doctl for kubernetes
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DEV_DIGITALOCEAN_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save ${{ secrets.DEV_CLUSTER_NAME }}
- name: Update kubernetes resources
run: kustomize build deployment/overlays/development | kubectl apply -n ${{ secrets.K8S_NAMESPACE }} --wait -f -