Merge pull request #164 from jihadkhawaja/end-to-end-encryption #40
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: chat-deploy | |
on: | |
push: | |
branches: [ "main"] | |
workflow_dispatch: | |
jobs: | |
dotnet-build-api: | |
name: Dotnet Build api | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore src/Egroo.Server/Egroo.Server.csproj | |
- name: Build | |
run: dotnet build --no-restore src/Egroo.Server/Egroo.Server.csproj | |
- name: Test | |
run: dotnet test --no-build --verbosity normal src/Egroo.Server/Egroo.Server.csproj | |
docker-build-api: | |
name: Docker Build api | |
environment: | |
name: 'Release API' | |
url: "https://api.egroo.org" | |
needs: dotnet-build-api | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Create appsettings | |
run: | | |
echo '{ | |
"Logging": { | |
"LogLevel": { | |
"Default": "Information", | |
"Microsoft.AspNetCore": "Warning" | |
} | |
}, | |
"AllowedHosts": "*", | |
"ConnectionStrings": { | |
"DefaultConnection": "Server='${{ secrets.REMOTE_HOST }}';Port=5432;User Id=postgres;Password='${{ secrets.REMOTE_PASSWORD }}';Database=egroo-prod;" | |
}, | |
"Secrets": { | |
"Jwt": "${{ secrets.JWT_PROD }}" | |
} | |
}' > src/Egroo.Server/appsettings.json | |
- name: build docker image | |
run: docker build -t jihadkhawaja/mobilechat-server-prod:latest -f src/Egroo.Server/Dockerfile . | |
- name: save docker image | |
run: | | |
docker save -o mobilechat-server-prod.tar jihadkhawaja/mobilechat-server-prod | |
- name: copy tar via ssh | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.KEY }} | |
port: 22 | |
source: "mobilechat-server-prod.tar" | |
target: "/home/ubuntu/images" | |
- name: executing remote ssh commands | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.KEY }} | |
script: | | |
docker load -i /home/ubuntu/images/mobilechat-server-prod.tar | |
rm /home/ubuntu/images/mobilechat-server-prod.tar | |
docker kill mobilechat-server-prod | |
docker system prune -f | |
docker run --name mobilechat-server-prod -p 49117:8080 --restart always -v public:/app/wwwroot/public -d jihadkhawaja/mobilechat-server-prod:latest | |
dotnet-build-wasm: | |
name: Dotnet Build wasm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore src/Egroo/Egroo/Egroo.csproj | |
- name: Build | |
run: dotnet build --no-restore src/Egroo/Egroo/Egroo.csproj | |
- name: Test | |
run: dotnet test --no-build --verbosity normal src/Egroo/Egroo/Egroo.csproj | |
docker-build-wasm: | |
name: Docker Build wasm | |
environment: | |
name: 'Release WEB' | |
url: "https://www.egroo.org" | |
needs: dotnet-build-wasm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: build docker image | |
run: docker build -t jihadkhawaja/mobilechat-wasm-prod:latest -f src/Egroo/Egroo/Dockerfile . | |
- name: save docker image | |
run: | | |
docker save -o mobilechat-wasm-prod.tar jihadkhawaja/mobilechat-wasm-prod | |
- name: copy tar via ssh | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.KEY }} | |
port: 22 | |
source: "mobilechat-wasm-prod.tar" | |
target: "/home/ubuntu/images" | |
- name: executing remote ssh commands | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.KEY }} | |
script: | | |
docker load -i /home/ubuntu/images/mobilechat-wasm-prod.tar | |
rm /home/ubuntu/images/mobilechat-wasm-prod.tar | |
docker kill mobilechat-wasm-prod | |
docker system prune -f | |
docker run --name mobilechat-wasm-prod -p 49168:8080 --restart always -v public:/app/wwwroot/public -d jihadkhawaja/mobilechat-wasm-prod:latest |