Added handlers for resolving image roots #13
This file contains hidden or 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 downpatch.com | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: downpatch-deploy | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Restore | |
| run: dotnet restore ./downpatch.csproj | |
| - name: Publish | |
| run: dotnet publish ./downpatch.csproj -c Release -o ./out -r linux-x64 --self-contained true /p:PublishSingleFile=false | |
| - name: Configure SSH | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| ssh-keyscan -p "${{ secrets.SSH_PORT }}" "${{ secrets.SSH_HOST }}" >> ~/.ssh/known_hosts | |
| - name: Upload release via rsync | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| RELEASE="${{ github.sha }}" | |
| rsync -az --delete \ | |
| -e "ssh -p ${{ secrets.SSH_PORT }} -i ~/.ssh/id_ed25519" \ | |
| ./out/ "${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/downpatch/releases/${RELEASE}/" | |
| - name: Activate release + restart service | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| RELEASE="${{ github.sha }}" | |
| ssh -p "${{ secrets.SSH_PORT }}" -i ~/.ssh/id_ed25519 "${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}" << EOF | |
| set -euo pipefail | |
| ln -sfn "/var/www/downpatch/releases/${RELEASE}" /var/www/downpatch/current | |
| sudo -n /usr/bin/systemctl restart downpatch.service | |
| EOF |