Skip to content

Commit

Permalink
Exclude pull requests from deploy workflow
Browse files Browse the repository at this point in the history
Related to #3

Update the deploy workflow to exclude pull requests from triggering the deployment process.
- Adds a `branches-ignore` condition under the `push` trigger in the `.github/workflows/deploy.yml` file to prevent branches created for pull requests from initiating the deploy to server workflow.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/MarkenJaden/Nekos.lol/issues/3?shareId=09dbfb5a-d94c-4217-9759-f8ae75f2e7bb).
  • Loading branch information
MarkenJaden committed Jun 25, 2024
1 parent c19ef72 commit 82f267c
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Nekos/.github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This is a basic workflow to help you get started with Actions

name: Deploy to Server

# Controls when the workflow will run
on:
push:
paths:
- 'Nekos/**'
branches-ignore:
- '**/pull/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_HOST }}

- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install dependencies
run: dotnet restore
- name: Build
run: |
cd Nekos
dotnet build --configuration Release
dotnet publish -c Release
- name: Deploy with rsync
run: rsync -avz -e 'ssh -p 4556 -o StrictHostKeyChecking=no' Nekos/bin/Release/net8.0/publish/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/nekos/
- name: Restart Nekos Website
run: ssh -p 4556 ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} 'service nekos restart'

0 comments on commit 82f267c

Please sign in to comment.