-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (35 loc) · 1.05 KB
/
deploy-backend.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Build image for backend
on:
push:
branches:
- main
- backend/dockerfile
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log into GitHub Container Registry
run: echo "${{ secrets.GH_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Go to backend repo
run: |
cd backend
- name: Add SHORT_SHA
run: |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
echo ${SHORT_SHA}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker build & push
uses: docker/build-push-action@v3
env:
SHORT_SHA: ${{ env.SHORT_SHA }}
with:
context: backend/
pull: true
push: true
tags: ghcr.io/snuhcs-course/swpp-2023-project-team-8/backend:${{ env.SHORT_SHA }}
cache-from: type=gha
cache-to: type=gha,mode=max