aaaa event manage should be able to modify food order attributes even… #109
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Add SHORT_SHA env property with commit short sha | |
id: get_short_sha | |
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Build apps | |
run: yarn build:all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Dockerize client | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./Dockerfile.client | |
context: . | |
push: true | |
tags: fllsk/tms-client:latest, fllsk/tms-client:sha-${{steps.get_short_sha.outputs.SHORT_SHA}} | |
- name: Dockerize server | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./Dockerfile.server | |
context: . | |
push: true | |
tags: fllsk/tms-server:latest, fllsk/tms-server:sha-${{steps.get_short_sha.outputs.SHORT_SHA}} | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Copy docker-compose.yaml to production server | |
# made by a random appleboy to copy specified file to target server | |
uses: appleboy/scp-action@v0.1.7 | |
with: | |
host: ${{ vars.DEPLOY_HOST }} | |
username: ${{ vars.DEPLOY_HOST_USERNAME }} | |
key: ${{ secrets.DEPLOY_HOST_SSH_KEY }} | |
source: 'docker-compose.yaml' | |
target: '~/.deploy/' | |
- name: Run docker-compose up on production server | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
host: ${{ vars.DEPLOY_HOST }} | |
username: ${{ vars.DEPLOY_HOST_USERNAME }} | |
key: ${{ secrets.DEPLOY_HOST_SSH_KEY }} | |
script: | | |
cd ~/ | |
sudo deploy-compose.sh deploy |