Deploy #18
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: Deploy | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 15 * *' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Publish | |
run: dotnet publish Countdown.Website --configuration Release --runtime linux-arm64 --output publish --self-contained true | |
- name: Remove existing files | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
port: ${{ secrets.PORT }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
fingerprint: ${{ secrets.HOST_FINGERPRINT }} | |
script: rm -rf /var/www/countdown/* | |
- name: SCP Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
port: ${{ secrets.PORT }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
fingerprint: ${{ secrets.HOST_FINGERPRINT }} | |
source: publish/* | |
target: /var/www/countdown | |
strip_components: 1 # Strip 'publish/' from the file path, so the resultant paths are countdown/*, not countdown/publish/* | |
- name: Restart site | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
port: ${{ secrets.PORT }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
fingerprint: ${{ secrets.HOST_FINGERPRINT }} | |
script: sudo systemctl restart countdown-aspnet.service |