Artifact workflow #474
Workflow file for this run
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: Server | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
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 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 ./.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 }} |