Skip to content

Artifact workflow

Artifact workflow #478

Workflow file for this run

name: Server
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build server
defaults:
run:
working-directory: ./server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Check CLI tools
run: |
for tool in dotnet; do
if ! command -v $tool &> /dev/null; then
echo "${tool} is not installed"
exit 1
fi
${tool} --version
done
- name: Restore dependencies
run: |
dotnet restore
- name: Build
run: |
dotnet build --no-restore
- name: Test
env:
AUTH0_CLIENT_ID: ${{ vars.AUTH0_CLIENT_ID }}
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }}
AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
MONGODB_DATABASE: ${{ vars.MONGODB_DATABASE }}
run: |
dotnet test --no-build --verbosity normal
- name: Upload deployment spec
uses: actions/upload-artifact@v4
with:
name: do
path: .do
deploy:
name: Deploy server
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
- name: Check artifact
run: |
ls -la
ls -la do
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DOCTL_TOKEN }}
- name: Update DigitalOcean app spec
if: ${{ github.ref == 'refs/heads/main' }}
run: |
doctl apps update ${{ secrets.DO_APP_ID }} \
--spec ${{ github.workspace }}/do/app.yaml
success:
name: Consolidated success
runs-on: ubuntu-latest
needs:
- build
- deploy
steps:
- name: Send status to Discord
uses: nebularg/actions-discord-webhook@v1
if: always()
with:
webhook_url: ${{ secrets.DISCORD_CI_WEBHOOK }}
status: ${{ job.status }}