forked from GrPe/Overmoney
-
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.
- Loading branch information
Showing
2 changed files
with
81 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: build | ||
name: Deploy API | ||
on: | ||
workflow_dispatch: | ||
push: | ||
|
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,80 @@ | ||
name: Deploy Portal | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- src/Overmoney.Portal/** | ||
|
||
env: | ||
PROJECT_NAME: src/Overmoney.Portal/ | ||
DOCKER_FILE: src/Overmoney.Portal/Dockerfile | ||
|
||
jobs: | ||
build_and_test: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ${{ env.PROJECT_NAME }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build project | ||
run: npm run build --production | ||
|
||
build_portal_docker_image: | ||
runs-on: ubuntu-latest | ||
needs: build_and_test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and export Docker Image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ${{ env.PROJECT_NAME }} | ||
file: ${{ env.DOCKER_FILE }} | ||
tags: overmoney_portal | ||
outputs: type=docker,dest=/tmp/overmoney_portal.tar | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: overmoney_portal | ||
path: /tmp/overmoney_portal.tar | ||
|
||
push_portal_image: | ||
runs-on: self-hosted | ||
needs: build_portal_docker_image | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: overmoney_portal | ||
path: /tmp | ||
|
||
- name: Load image | ||
run: | | ||
docker load --input /tmp/overmoney_portal.tar | ||
|
||
- name: Add image tag | ||
run: docker tag overmoney_portal:latest localhost:5000/overmoney_portal | ||
|
||
- name: Push image | ||
run: docker push localhost:5000/overmoney_portal | ||
|
||
- name: Restart container | ||
run: docker run -rm --name overmoney_update -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once overmoney_portal |