Skip to content

Use centralized package version management #145

Use centralized package version management

Use centralized package version management #145

Workflow file for this run

name: build-api-dev
on:
workflow_dispatch:
push:
branches: [ main ]
paths-ignore:
- site/**
- src/RoadCaptain.App.Runner/** # Don't trigger on Runner only changes
- src/RoadCaptain.App.RouteBuilder/** # Don't trigger on RouteBuilder only changes
jobs:
build_api_linux-x64:
runs-on: ubuntu-latest
env:
CONFIGURATION: Debug
RID: linux-x64
ZIP_FILE: roadcaptain-app-web-dev-${{ github.sha }}.tar.gz
steps:
- uses: actions/checkout@v3
- name: Publish API
# Because of reasons we need to explicitly set RuntimeIdentifiers to only win-x64 because MSBuild sets it to osx-x64;win-x64
run: dotnet publish --no-self-contained -c ${{ env.CONFIGURATION }} -r ${{ env.RID }} -p:RuntimeIdentifiers=${{ env.RID }} src/RoadCaptain.App.Web/RoadCaptain.App.Web.csproj
- name: Create ZIP archive
run: tar -zcf "${{ github.workspace }}/${{ env.ZIP_FILE }}" *
working-directory: src/RoadCaptain.App.Web/bin/${{ env.CONFIGURATION }}/net6.0/linux-x64/publish
- name: Setup SSH key
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.SSH_SITE_KEY }}"
- name: Copy artifacts to server
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: scp -r -o "StrictHostKeyChecking no" "${{ github.workspace }}/${{ env.ZIP_FILE }}" roadcaptain@roadcaptain.nl:/opt/roadcaptain/${{ env.ZIP_FILE }}
- name: Extract artifacts on server
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: ssh -o "StrictHostKeyChecking no" roadcaptain@roadcaptain.nl 'systemctl stop --user RoadCaptainApiDev; cd /opt/roadcaptain/api-dev; tar -zxf /opt/roadcaptain/${{ env.ZIP_FILE }}; systemctl start --user RoadCaptainApiDev; rm -f /opt/roadcaptain/roadcaptain-app-web-dev-*.tar.gz'