-
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.
Technical feature/nr 60 deployment hook (#181)
* Decomposed pipeline # validate pipeline for pull requests to master # cicd pipeline with deployment hook on pushes to master * added pr trigger * renamed worklow * removed workflow * added test change * removed test code
- Loading branch information
1 parent
70433b8
commit 3b29542
Showing
2 changed files
with
60 additions
and
19 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
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,59 @@ | ||
name: Validate and deploy backend. | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths: ["backend/**"] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.12.1] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
- name: Install backend dependencies | ||
run: npm ci -w backend | ||
- name: Prettier check | ||
run: npm run -w backend prettier:check | ||
- name: Unit tests | ||
run: npm run -w backend unit-test | ||
- name: Integration tests | ||
run: npm run -w backend integration-test | ||
|
||
build-and-push: | ||
needs: tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
file: backend/Dockerfile | ||
tags: sjakusch/steam-game-stats-backend:latest | ||
|
||
deploy: | ||
needs: build-and-push | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy on Render | ||
if: github.ref == 'refs/heads/master' | ||
env: | ||
deploy_url: ${{ secrets.RENDER_DEPLOY_HOOK_URL }} | ||
run: | | ||
curl "$deploy_url" |