Skip to content

Build and deploy backend core on server #40

Build and deploy backend core on server

Build and deploy backend core on server #40

name: Build and deploy backend core on server
on:
push:
paths:
- 'backend/**'
branches:
- deploy
workflow_dispatch:
jobs:
docker:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Build
uses: docker/build-push-action@v3
with:
context: backend/
push: false
load: true
tags: ghcr.io/marcindz88/jetlag/jetlag-core:latest
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
-
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
-
name: Push docker image to registry
run: |

Check failure on line 50 in .github/workflows/deploy-backend.yml

View workflow run for this annotation

GitHub Actions / Build and deploy backend core on server

Invalid workflow file

The workflow is not valid. .github/workflows/deploy-backend.yml (Line: 50, Col: 12): Unrecognized named-value: 'GH_TOKEN'. Located at position 1 within expression: GH_TOKEN
docker login ghcr.io -u marcindz88 --password ${{GH_TOKEN}}
docker push ghcr.io/marcindz88/jetlag/jetlag-core:latest
env:
SERVER_SSH_KEY: ${{secrets.SERVER_SSH_KEY}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
-
name: Rollout restart image on the server
run: |
echo "$SERVER_SSH_KEY" > private.key
chmod 400 private.key
ssh -i private.key -o StrictHostKeyChecking=no root@${{secrets.SERVER_IP}} "kubectl rollout restart deployment/jetlag-core -n jetlag"
env:
SERVER_IP: ${{secrets.SERVER_IP}}
SERVER_SSH_KEY: ${{secrets.SERVER_SSH_KEY}}