-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- resolved #387 EC2에 서비스를 배포합니다. 워크플로 등록을 위해 main에 머지 배포 URL: - (develop) [https://dev.sssupport.shop](https://dev.sssupport.shop) - (production) [https://sssupport.shop](https://sssupport.shop) - 추후 `stu.ssu.ac.kr`에도 연결 예정 @jongse7 프로덕션에서 `VITE_REST_API_KEY` 값 설정이 필요합니다. 나중에 전달 해주시거나 아니면 `prod` environment에 `VITE_REST_API_KEY` 시크릿 업데이트 후 알려주세요. - [x] `develop` 브랜치의 최신 코드를 `pull` 받았나요?
- Loading branch information
Showing
3 changed files
with
104 additions
and
39 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,55 @@ | ||
name: Deployment (Develop) | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
environment: develop | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: 'package.json' | ||
- name: Retrive caches | ||
uses: actions/cache@v4 | ||
with: | ||
path: node_modules | ||
key: ${{ hashFiles('yarn.lock') }} | ||
- name: Enable corepack | ||
run: corepack enable | ||
- name: Install project | ||
run: yarn install --immutable | ||
- name: Build | ||
run: yarn build | ||
env: | ||
VITE_API_URL: ${{ vars.VITE_API_URL }} | ||
VITE_REDIRECT_URI: ${{ vars.VITE_REDIRECT_URI }} | ||
VITE_REST_API_KEY: ${{ secrets.VITE_REST_API_KEY }} | ||
- name: Compress build artifacts | ||
run: tar -cvf ./dist.tar ./dist | ||
- name: Upload with SCP | ||
uses: appleboy/scp-action@v0.1.7 | ||
with: | ||
username: ubuntu | ||
host: ${{ secrets.SSH_HOST }} | ||
key: ${{ secrets.SSH_KEY }} | ||
source: "dist.tar" | ||
target: "/home/ubuntu/" | ||
- name: Extract artifact with SSH | ||
uses: appleboy/ssh-action@v1.2.0 | ||
with: | ||
username: ubuntu | ||
host: ${{ secrets.SSH_HOST }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
tar -xvf ./dist.tar ./dist | ||
sudo rm -rf /var/www/homepage-frontend | ||
sudo mv ./dist /var/www/homepage-frontend | ||
rm -rf ./dist | ||
rm -f ./dist.tar |
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,48 +1,55 @@ | ||
name: Deploy | ||
name: Deployment (Production) | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
container: pandoc/latex | ||
|
||
environment: prod | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install mustache (to update the date) | ||
|
||
run: apk add ruby && gem install mustache | ||
|
||
- name: creates output | ||
|
||
run: sh ./build.sh | ||
|
||
- name: Pushes to another repository | ||
|
||
id: push_directory | ||
|
||
uses: cpina/github-action-push-to-another-repository@main | ||
|
||
- name: Repository checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: 'package.json' | ||
- name: Retrive caches | ||
uses: actions/cache@v4 | ||
with: | ||
path: node_modules | ||
key: ${{ hashFiles('yarn.lock') }} | ||
- name: Enable corepack | ||
run: corepack enable | ||
- name: Install project | ||
run: yarn install --immutable | ||
- name: Build | ||
run: yarn build | ||
env: | ||
API_TOKEN_GITHUB: ${{ secrets.AUTO_ACTIONS }} | ||
|
||
VITE_API_URL: ${{ vars.VITE_API_URL }} | ||
VITE_REDIRECT_URI: ${{ vars.VITE_REDIRECT_URI }} | ||
VITE_REST_API_KEY: ${{ secrets.VITE_REST_API_KEY }} | ||
- name: Compress build artifacts | ||
run: tar -cvf ./dist.tar ./dist | ||
- name: Upload with SCP | ||
uses: appleboy/scp-action@v0.1.7 | ||
with: | ||
source-directory: 'output' | ||
|
||
destination-github-username: ssu-it-support | ||
|
||
destination-repository-name: homepage-frontend | ||
|
||
user-email: ${{ secrets.EMAIL }} | ||
|
||
commit-message: ${{ github.event.commits[0].message }} | ||
|
||
target-branch: main | ||
|
||
- name: Test get variable exported by push-to-another-repository | ||
|
||
run: echo $DESTINATION_CLONED_DIRECTORY | ||
username: ubuntu | ||
host: ${{ secrets.SSH_HOST }} | ||
key: ${{ secrets.SSH_KEY }} | ||
source: "dist.tar" | ||
target: "/home/ubuntu/" | ||
- name: Extract artifact with SSH | ||
uses: appleboy/ssh-action@v1.2.0 | ||
with: | ||
username: ubuntu | ||
host: ${{ secrets.SSH_HOST }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
tar -xvf ./dist.tar ./dist | ||
sudo rm -rf /var/www/homepage-frontend | ||
sudo mv ./dist /var/www/homepage-frontend | ||
rm -rf ./dist | ||
rm -f ./dist.tar |
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