Overflow/.github/workflows/ci.yml

79 lines
2.2 KiB
YAML
Raw Normal View History

name: ci
on: [push]
jobs:
build:
runs-on: ubuntu-latest
2024-07-07 22:45:54 +01:00
name: Build & Unit Test
strategy:
fail-fast: false
matrix:
dotnet-version: [ '8.0.x' ]
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: ${{ matrix.dotnet-version }}
2024-06-09 18:48:15 +01:00
- name: Install WASM Workload
run: dotnet workload install wasm-tools
- name: Install Dependencies
run: dotnet restore Overflow.sln
- name: Build
run: dotnet build --configuration Debug --no-restore Overflow.sln
- name: Test
run: dotnet test --no-restore --verbosity normal Overflow.sln
build-Docker:
runs-on: ubuntu-latest
2024-07-07 22:45:54 +01:00
name: Build Containers
2024-06-09 18:44:44 +01:00
needs: [build] # for ignoring bad builds
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Web Container
uses: docker/build-push-action@v5
with:
push: true
tags: |
sarsoo/overflow:latest
sarsoo/overflow:${{ github.ref_name }}
file: Dockerfile
2024-07-07 22:45:54 +01:00
deploy:
runs-on: ubuntu-latest
name: Deploy
needs: [build-Docker] # for ignoring bad builds
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
environment:
name: prod
url: https://overflow.sarsoo.xyz
steps:
- uses: actions/checkout@v3
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
version: 1.68.1
- name: Deploy
run: ssh -o StrictHostKeyChecking=no ${{ secrets.TS_SSH }} -t "cd overflow/ && docker compose up -d --pull always"