Skip to content

Commit

Permalink
Merge pull request #17 from informatyzacja/add-cd
Browse files Browse the repository at this point in the history
ci: add CD and semantic-release
  • Loading branch information
Rei-x authored Feb 12, 2023
2 parents 52e6c6e + 54284f6 commit ac81c62
Show file tree
Hide file tree
Showing 8 changed files with 14,250 additions and 4,776 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CD

on:
push:
branches: ["master"]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment:
name: production
url: https://sos.sspwr.edu.eu.org
steps:
- name: Deploy
uses: appleboy/ssh-action@v0.1.7
env:
CI: true
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
envs: CI
script: |
cd ${{ secrets.APP_DIR }}
rm .env
touch .env
echo NEXTAUTH_URL=https://sos.sspwr.edu.eu.org >> .env
echo NEXTAUTH_SECRET={{ secrets.NEXTAUTH_SECRET }} >> .env
echo GOOGLE_CLIENT_ID=123 >> .env
echo GOOGLE_CLIENT_SECRET=123 >> .env
echo DATABASE_URL="postgres://postgres:postgres@localhost:5432/postgres" >> .env
git pull
npm ci
npm run build
pm2 reload ecosystem.config.js
release:
name: Release
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: bahmutov/npm-install@v1
with:
useRollingCache: true
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
run: npx semantic-release
30 changes: 30 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"branches": [
"master"
],
"repositoryUrl": "git@github.com:informatyzacja/strona-organizacji-studenckich.git",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"type": "build",
"scope": "deps",
"release": "patch"
}
]
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/github",
"@semantic-release/npm",
[
"@semantic-release/git",
{
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
12 changes: 12 additions & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
apps: [
{
name: "app",
script: "node_modules/.bin/next",
args: "start",
env: {
NODE_ENV: "production",
},
},
],
};
Loading

0 comments on commit ac81c62

Please sign in to comment.