chore: initial commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
name: Deploy
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- '.gitignore'
|
||||
- '**/*/LICENSE.md'
|
||||
- '**/*/README.md'
|
||||
- '**/*/Dockerfile'
|
||||
jobs:
|
||||
build:
|
||||
name: Build and push Docker image
|
||||
runs-on: ubuntu-24.04-arm
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Create version tag
|
||||
id: version
|
||||
run: echo "version=$(date +%Y.%m.%d.%H%M%S)-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
- name: Build and push server image
|
||||
run: |
|
||||
TAG=${{ secrets.DOCKERHUB_USERNAME }}/groundsforsupport.stevanfreeborn.com:${{ steps.version.outputs.version }}
|
||||
docker build -t $TAG .
|
||||
docker push $TAG
|
||||
deploy:
|
||||
name: Deploy to server
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Run deploy script
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USERNAME }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
script: |
|
||||
TAG=${{ secrets.DOCKERHUB_USERNAME }}/groundsforsupport.stevanfreeborn.com:${{ needs.build.outputs.version }}
|
||||
|
||||
docker stop groundsforsupport.stevanfreeborn.com
|
||||
docker rm groundsforsupport.stevanfreeborn.com
|
||||
|
||||
docker pull $TAG
|
||||
docker run \
|
||||
--restart always \
|
||||
-d \
|
||||
-p 4343:8080 \
|
||||
--name groundsforsupport.stevanfreeborn.com \
|
||||
$TAG
|
||||
@@ -0,0 +1,64 @@
|
||||
name: Pull Request
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- '.gitignore'
|
||||
- '**/*/LICENSE.md'
|
||||
- '**/*/README.md'
|
||||
- '**/*/Dockerfile'
|
||||
jobs:
|
||||
run_tests:
|
||||
name: Run tests
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup .NET
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: lts/*
|
||||
- name: Install report generator
|
||||
run: dotnet tool install --global dotnet-reportgenerator-globaltool
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build solution
|
||||
run: dotnet build --no-restore
|
||||
- name: Test solution
|
||||
run: dotnet test
|
||||
- name: Upload server test coverage
|
||||
uses: action/upload-artifact@v4
|
||||
with:
|
||||
name: server-test-coverage
|
||||
path: tests/GroundsForSupport.Server.Tests/TestResults/
|
||||
- name: Upload client test coverage
|
||||
uses: action/upload-artifact@v4
|
||||
with:
|
||||
name: client-test-coverage
|
||||
path: src/GroundsForSupport.Client/coverage/
|
||||
lint_and_format:
|
||||
name: Lint and Format
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup .NET
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: lts/*
|
||||
- name: Format dotnet solution
|
||||
run: dotnet format
|
||||
- name: Lint and format client
|
||||
working-directory: src/GroundsForSupport.Client/
|
||||
run: npm run lint && npm run format
|
||||
Reference in New Issue
Block a user