1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

Add automatic deployment

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-08-14 16:59:29 +05:00
parent da2a88246c
commit f6241702da
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
4 changed files with 89 additions and 36 deletions

View file

@ -1760,3 +1760,7 @@ resharper_zero_index_from_end_highlighting = warning
indent_style = space
indent_size = 4
tab_width = 4
[*.yml]
indent_style = space
indent_size = 2

34
.github/workflows/build-pr.yml vendored Normal file
View file

@ -0,0 +1,34 @@
name: "Inspect code with ReSharper"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches: [ "master" ]
merge_group:
types: [ checks_requested ]
jobs:
inspect-code:
name: Inspect code
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Restore dependencies and tools
run: dotnet restore
- name: ReSharper CLI InspectCode
uses: muno92/resharper_inspectcode@1.8.0
with:
solutionPath: ./Boyfriend.sln
ignoreIssueType: InvertIf, ConvertIfStatementToSwitchStatement
extensions: ReSharperPlugin.CognitiveComplexity
solutionWideAnalysis: true

51
.github/workflows/build-push.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: "Publish and deploy"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [ "test" ]
jobs:
upload-solution:
name: Upload Boyfriend to production
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
environment: production
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Restore dependencies and tools
run: dotnet restore
- name: Publish solution
run: dotnet publish -c Release -r linux-x64 --no-self-contained -p:PublishReadyToRun=true
- name: Quit currently running instance
run: |
ssh $SSH_USER@$SSH_HOST pkill --signal SIGQUIT Boyfriend
shell: bash
env:
SSH_USER: ${{secrets.SSH_USER}}
SSH_HOST: ${{secrets.SSH_HOST}}
- name: Upload published solution
run: scp -r bin/Release/net7.0/linux-x64/publish/* $SSH_USER@$SSH_HOST:$UPLOAD_DESTINATION
env:
SSH_USER: ${{secrets.SSH_USER}}
SSH_HOST: ${{secrets.SSH_HOST}}
UPLOAD_DESTINATION: ${{secrets.UPLOAD_DESTINATION}}
- name: Start uploaded solution
run: |
ssh $SSH_USER@$SSH_HOST $COMMAND
shell: bash
env:
SSH_USER: ${{secrets.SSH_USER}}
SSH_HOST: ${{secrets.SSH_HOST}}
COMMAND: ${{secrets.COMMAND}}

View file

@ -1,36 +0,0 @@
name: "ReSharper"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "master" ]
merge_group:
types: [checks_requested]
jobs:
inspect-code:
name: Inspect code
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Restore dependencies and tools
run: dotnet restore
- name: ReSharper CLI InspectCode
uses: muno92/resharper_inspectcode@1.8.0
with:
solutionPath: ./Boyfriend.sln
ignoreIssueType: InvertIf, ConvertIfStatementToSwitchStatement
extensions: ReSharperPlugin.CognitiveComplexity
solutionWideAnalysis: true