Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.

Commit bb613f8

Browse files
committed
Deploy BE to cloud
1 parent 4a94b13 commit bb613f8

2 files changed

Lines changed: 54 additions & 7 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build and Deploy
2+
3+
on:
4+
pull_request: # this is temporary
5+
push:
6+
branches: [main]
7+
8+
env:
9+
AZURE_WEBAPP_NAME: pera-be
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
jobs:
16+
build-and-deploy:
17+
name: Build and Deploy
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v3
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
- name: Log in to GitHub container registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
- name: Lowercase the repo name
32+
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
33+
- name: Build with Docker
34+
uses: docker/build-push-action@v6
35+
with:
36+
load: true
37+
tags: '${{ env.REPO }}:test'
38+
- name: Run Pytest
39+
run: |
40+
docker run --rm ${{ env.REPO }}:test pytest
41+
- name: Build and push to registry
42+
uses: docker/build-push-action@v6
43+
with:
44+
push: true
45+
tags: ghcr.io/${{ env.REPO }}:${{ github.sha }}
46+
- name: Deploy to Azure App Service
47+
id: deploy-to-webapp
48+
uses: azure/webapps-deploy@v3
49+
with:
50+
app-name: ${{ env.AZURE_WEBAPP_NAME }}
51+
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
52+
images: 'ghcr.io/${{ env.REPO }}:${{ github.sha }}'
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
name: Build and Pytest
22

33
on:
4-
push:
5-
branches: [main]
64
pull_request:
75

8-
env:
9-
TEST_TAG: pera-backend-test
10-
116
jobs:
127
docker:
138
name: Build and Pytest
@@ -21,7 +16,7 @@ jobs:
2116
uses: docker/build-push-action@v6
2217
with:
2318
load: true
24-
tags: ${{ env.TEST_TAG }}
19+
tags: '${{ env.REPO }}:test'
2520
- name: Run Pytest
2621
run: |
27-
docker run --rm ${{ env.TEST_TAG }} pytest
22+
docker run --rm ${{ env.REPO }}:test pytest

0 commit comments

Comments
 (0)