-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from informatyzacja/add-cd
ci: add CD and semantic-release
- Loading branch information
Showing
8 changed files
with
14,250 additions
and
4,776 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
}, | ||
}, | ||
], | ||
}; |
Oops, something went wrong.