Skip to content

Commit cb67adb

Browse files
committed
update workflows
1 parent 7f368e5 commit cb67adb

File tree

2 files changed

+50
-7
lines changed

2 files changed

+50
-7
lines changed

.deploy/litestream-template.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
access-key-id: ${R2_ACCESS_KEY_ID}
2+
secret-access-key: ${R2_SECRET_ACCESS_KEY}
3+
dbs:
4+
- path: /data/app.db
5+
replicas:
6+
- type: s3
7+
bucket: ${R2_BUCKET}
8+
path: app.db
9+
region: auto
10+
endpoint: ${R2_ENDPOINT}

.github/workflows/release.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,29 @@ jobs:
4949
echo "TAG_NAME=${{ github.event.inputs.version }}" >> $GITHUB_ENV
5050
fi;
5151
52+
- name: setup .net core
53+
uses: actions/setup-dotnet@v3
54+
with:
55+
dotnet-version: '8.*'
56+
57+
- name: Install x tool
58+
run: dotnet tool install -g x
59+
60+
- name: Apply Production AppSettings
61+
working-directory: ./BlazorDiffusion
62+
run: |
63+
cat <<EOF >> appsettings.json.patch
64+
${{ secrets.APPSETTINGS_PATCH }}
65+
EOF
66+
x patch appsettings.json.patch
67+
5268
- name: Login to GitHub Container Registry
5369
uses: docker/login-action@v2
5470
with:
5571
registry: ghcr.io
5672
username: ${{ github.actor }}
5773
password: ${{ secrets.GITHUB_TOKEN }}
58-
5974

60-
- name: Setup dotnet
61-
uses: actions/setup-dotnet@v3
62-
with:
63-
dotnet-version: '8.*'
64-
6575
# Build and push new docker image, skip for manual redeploy other than 'latest'
6676
- name: Build and push Docker image
6777
run: |
@@ -103,6 +113,8 @@ jobs:
103113
echo "APP_NAME=${{ github.event.repository.name }}" >> .deploy/.env
104114
echo "IMAGE_REPO=${{ env.image_repository_name }}" >> .deploy/.env
105115
echo "RELEASE_VERSION=${{ env.TAG_NAME }}" >> .deploy/.env
116+
echo "R2_ACCESS_KEY_ID=${{ secrets.R2_ACCESS_KEY_ID }}" >> .deploy/.env
117+
echo "R2_SECRET_ACCESS_KEY=${{ secrets.R2_SECRET_ACCESS_KEY }}" >> .deploy/.env
106118
107119
# Copy only the docker-compose.yml to remote server home folder
108120
- name: copy files to target server via scp
@@ -115,7 +127,28 @@ jobs:
115127
strip_components: 2
116128
source: "./.deploy/docker-compose.yml,./.deploy/.env"
117129
target: "~/.deploy/${{ github.event.repository.name }}/"
118-
130+
131+
# Populate litestream.yml with variables from build process, including TAG_NAME.
132+
- name: litestream.yml file prep
133+
uses: danielr1996/[email protected]
134+
env:
135+
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
136+
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
137+
with:
138+
input: .deploy/litestream-template.yml
139+
output: .deploy/litestream.yml
140+
141+
- name: copy litestream.yml file via scp
142+
uses: appleboy/[email protected]
143+
with:
144+
host: ${{ secrets.DEPLOY_HOST }}
145+
username: ${{ secrets.DEPLOY_USERNAME }}
146+
port: 22
147+
strip_components: 1
148+
key: ${{ secrets.DEPLOY_KEY }}
149+
source: ".deploy/litestream.yml"
150+
target: ".deploy/${{ github.event.repository.name }}/config"
151+
119152
- name: Run remote db migrations
120153
uses: appleboy/[email protected]
121154
env:

0 commit comments

Comments
 (0)