Merge pull request #266 from hhbb0081/test #200
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
name: Test Server Merge | |
on: | |
push: | |
branches: [ "test" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code. # Repo checkout | |
uses: actions/checkout@v3 | |
- name: Check Node v # Node v 확인 | |
run: node -v | |
- name: Install dependencies # 의존 파일 설치 | |
run: npm install | |
- name: Set .env from secrets | |
run: | | |
echo "${{ secrets.TEST_ENV }}" > .env | |
- name: cat env file | |
run: cat .env | |
- name: Generate build # React Build | |
run: npm run build | |
# - name: file copy | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: build | |
# path: build | |
# deploy: | |
# needs: build | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: file download | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: build | |
# path: build | |
# - name: Upload to Cloudflare | |
# env: | |
# AWS_ACCESS_KEY_ID: ${{ secrets.CF_ACCESS_KEY_ID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }} | |
# AWS_DEFAULT_REGION: us-east-1 | |
# BUCKET_NAME: ${{ secrets.CF_BUCKET_NAME }} | |
# ENDPOINT_URL: ${{ secrets.CF_ENDPOINT_URL }} | |
# run: | | |
# aws s3 sync build s3://$BUCKET_NAME/build \ | |
# --endpoint-url $ENDPOINT_URL --delete --exact-timestamps | |
- name: Upload to Cloudflare | |
uses: jakejarvis/[email protected] | |
with: | |
args: --delete --exact-timestamps | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.CF_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }} | |
AWS_S3_ENDPOINT: ${{ secrets.CF_ENDPOINT_URL }} | |
AWS_REGION: us-east-1 | |
AWS_S3_BUCKET: ${{ secrets.CF_BUCKET_NAME }} | |
SOURCE_DIR: 'build' | |
DEST_DIR: 'build' | |
- name: SSH and deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
port: ${{ secrets.PORT }} | |
timeout: 40s # 30초 기본 | |
script: | | |
aws s3 sync s3://readyvery-dev-server/build ./docker/react/build \ | |
--endpoint-url https://29c6e4b55b1ddb8d2b6e69df21141caa.r2.cloudflarestorage.com \ | |
--delete --exact-timestamps | |
- name: Discordbot alert # 디스코드 알림 | |
uses: sarisia/[email protected] | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
content: ${{ (github.actor == 'marinesnow34' && '<@392607023495118862>') || | |
(github.actor == '1223v' && '<@368775981667844098>') || | |
(github.actor == 'imi21123' && '<@999337351799128115>') || | |
(github.actor == 'marina-yhm' && '<@946431150614794240>') || | |
(github.actor == 'hhhhyelim' && '<@1076887091427946496>') || | |
(github.actor == 'hhbb0081' && '<@739857755271200892>') }} | |
if: always() |