forked from digital-cube/opencon-webadmin
-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (46 loc) · 1.56 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: CI/CD
on:
push:
pull_request:
env:
NODE_VERSION: 20.x
PROJECT_NAME: sfscon-webadmin
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/sfscon-webadmin
jobs:
deploy-test:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main'
concurrency: deploy-test
env:
SERVER_PORT: 1096
DOCKER_TAG: ${{ github.sha }}-test
steps:
- name: Checkout source code
uses: actions/checkout@v4
- uses: noi-techpark/github-actions/npm-build@v2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
env:
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_SERVER_PORT: ${{ env.SERVER_PORT }}
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
- name: Build and push images
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
working-directory: infrastructure
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy application
uses: noi-techpark/github-actions/docker-deploy@v2
with:
working-directory: infrastructure/ansible
hosts: "test"
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
docker-username: "noi-techpark-bot"
docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
project-name: ${{ env.PROJECT_NAME }}