forked from nostria-app/nostria
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (63 loc) · 2.25 KB
/
deploy.yml
File metadata and controls
77 lines (63 loc) · 2.25 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Build and Deploy to Beta
on:
push:
branches: [main]
workflow_dispatch:
env:
AZURE_WEBAPP_NAME: nostria-beta
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_TAG: ${{ github.sha }}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 24
cache: "npm"
- name: Update manifest with build info
run: |
BUILD_DATE=$(date -u +"%Y-%m-%d")
COMMIT_SHA="${{ github.sha }}"
COMMIT_SHORT="${COMMIT_SHA:0:7}"
# Update manifest.webmanifest with commit and build date
jq --arg commit "$COMMIT_SHA" --arg commitShort "$COMMIT_SHORT" --arg buildDate "$BUILD_DATE" \
'. + {commitSha: $commit, commitShort: $commitShort, buildDate: $buildDate}' \
public/manifest.webmanifest > public/manifest.webmanifest.tmp
mv public/manifest.webmanifest.tmp public/manifest.webmanifest
echo "Updated manifest with commit $COMMIT_SHORT and build date $BUILD_DATE"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy to Azure Web App for Containers (Beta)
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
- name: Azure logout
run: |
az logout