Fix logout (#95) #97
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: Staging Deployment Backend | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- "backend/**" | |
- ".github/workflows/staging-deploy-backend.yml" | |
- "deployments/staging-backend-deployment.yaml" | |
branches: | |
- master | |
jobs: | |
lint-format: | |
name: lint and format | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
- name: get pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: get node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: install dependencies | |
run: pnpm --filter=backend -config.-dedupe-peer-dependents=false i --frozen-lockfile | |
- name: lint | |
run: pnpm run backend lint | |
- name: check formatting | |
run: | | |
if ! pnpm run format-check ; then | |
echo "Please format the code by running: pnpm run format" | |
exit 1 | |
fi | |
test: | |
name: test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
- name: get pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: get node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: install dependencies | |
run: pnpm --filter=backend -config.-dedupe-peer-dependents=false i --frozen-lockfile | |
- name: test | |
run: pnpm run backend test | |
build-image: | |
runs-on: ubuntu-22.04 | |
needs: [lint-format, test] | |
name: build & push docker image | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
- name: set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: set up docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: docker metadata | |
id: metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: notemann27/rememberry-backend | |
tags: | | |
type=raw,value=${{ github.sha }} | |
type=raw,value=latest | |
- name: log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./backend/Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.metadata.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push-staging: | |
runs-on: ubuntu-22.04 | |
name: deploy changes on staging | |
#if: github.ref == 'refs/heads/master' | |
needs: build-image | |
steps: | |
- name: set the kubernetes context | |
uses: azure/k8s-set-context@v3 | |
with: | |
method: service-account | |
k8s-url: ${{ secrets.KUBE_SERVER_URL }} | |
k8s-secret: ${{ secrets.KUBE_SERVICE_ACC_SECRET }} | |
- uses: actions/checkout@v4 | |
name: checkout deployments | |
with: | |
submodules: "recursive" | |
- name: set new kustomize image tag | |
env: | |
GITHUB_SHA: ${{ github.sha }} | |
working-directory: "deployments/backend/base" | |
run: | | |
kustomize edit set image rem-backend-image=notemann27/rememberry-backend:$GITHUB_SHA | |
- name: apply new config to deploy in cluster | |
working-directory: "deployments/backend" | |
run: | | |
kubectl apply -k staging |