Release 1.3 (#3) #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: prod | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
publish: | |
runs-on: ubuntu-latest | |
environment: prod | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: SSH deploy | |
uses: easingthemes/[email protected] | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
REMOTE_HOST: ${{ secrets.SSH_HOST }} | |
REMOTE_USER: ${{ secrets.SSH_USER }} | |
REMOTE_PORT: ${{ secrets.SSH_PORT }} | |
TARGET: ${{ secrets.SSH_TARGET_DIR }} | |
EXCLUDE: "/.git/, /.github/" | |
SCRIPT_AFTER: | | |
cd ${{ secrets.SSH_TARGET_DIR }} | |
# Fill the environment variables | |
echo "Auth__SecretKey='${{ secrets.AUTH_SECRET_KEY }}'" > ".env" | |
echo "Bot__Token='${{ secrets.TELEGRAM_BOT_TOKEN }}'" >> ".env" | |
echo "ConnectionStrings__ElectricityConnectionString='${{ secrets.ELECTRICITY_CONNECTION_STRING }}'" >> ".env" | |
echo "ConnectionStrings__HangfireConnectionString='${{ secrets.HANGFIRE_CONNECTION_STRING }}'" >> ".env" | |
echo "ApplicationInsights__ConnectionString='${{ secrets.APP_INSIGHTS_CONNECTION_STRING }}'" >> ".env" | |
echo "DatabaseEncryptionOptions__EncryptionKey='${{ secrets.DATABASE_AES_ENCRYPTION_KEY_BASE64 }}'" >> ".env" | |
echo "DatabaseEncryptionOptions__EncryptionIV='${{ secrets.DATABASE_AES_ENCRYPTION_IV_BASE64 }}'" >> ".env" | |
sudo docker compose down | |
sudo docker compose up --build -d |