Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Sep 30, 2024
1 parent 7f368e5 commit cb67adb
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
10 changes: 10 additions & 0 deletions .deploy/litestream-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
access-key-id: ${R2_ACCESS_KEY_ID}
secret-access-key: ${R2_SECRET_ACCESS_KEY}
dbs:
- path: /data/app.db
replicas:
- type: s3
bucket: ${R2_BUCKET}
path: app.db
region: auto
endpoint: ${R2_ENDPOINT}
47 changes: 40 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,29 @@ jobs:
echo "TAG_NAME=${{ github.event.inputs.version }}" >> $GITHUB_ENV
fi;
- name: setup .net core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.*'

- name: Install x tool
run: dotnet tool install -g x

- name: Apply Production AppSettings
working-directory: ./BlazorDiffusion
run: |
cat <<EOF >> appsettings.json.patch
${{ secrets.APPSETTINGS_PATCH }}
EOF
x patch appsettings.json.patch
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.*'

# Build and push new docker image, skip for manual redeploy other than 'latest'
- name: Build and push Docker image
run: |
Expand Down Expand Up @@ -103,6 +113,8 @@ jobs:
echo "APP_NAME=${{ github.event.repository.name }}" >> .deploy/.env
echo "IMAGE_REPO=${{ env.image_repository_name }}" >> .deploy/.env
echo "RELEASE_VERSION=${{ env.TAG_NAME }}" >> .deploy/.env
echo "R2_ACCESS_KEY_ID=${{ secrets.R2_ACCESS_KEY_ID }}" >> .deploy/.env
echo "R2_SECRET_ACCESS_KEY=${{ secrets.R2_SECRET_ACCESS_KEY }}" >> .deploy/.env
# Copy only the docker-compose.yml to remote server home folder
- name: copy files to target server via scp
Expand All @@ -115,7 +127,28 @@ jobs:
strip_components: 2
source: "./.deploy/docker-compose.yml,./.deploy/.env"
target: "~/.deploy/${{ github.event.repository.name }}/"


# Populate litestream.yml with variables from build process, including TAG_NAME.
- name: litestream.yml file prep
uses: danielr1996/[email protected]
env:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
with:
input: .deploy/litestream-template.yml
output: .deploy/litestream.yml

- name: copy litestream.yml file via scp
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
port: 22
strip_components: 1
key: ${{ secrets.DEPLOY_KEY }}
source: ".deploy/litestream.yml"
target: ".deploy/${{ github.event.repository.name }}/config"

- name: Run remote db migrations
uses: appleboy/[email protected]
env:
Expand Down

0 comments on commit cb67adb

Please sign in to comment.