From 82e08ac43bb35fc0b007f4afc0cf470e49e78b34 Mon Sep 17 00:00:00 2001 From: ssojungg Date: Wed, 17 Jan 2024 21:08:23 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20ci=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..eb45ba9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +name: Node.js CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + env: + DB_HOST: ${{ secrets.DB_HOST }} + DB_USERNAME: ${{ secrets.DB_USERNAME }} + DB_PASSWORD: ${{ secrets.DB_PASSWORD }} + DB_DATABASE: ${{ secrets.DB_DATABASE }} + DB_PORT: ${{ secrets.DB_PORT }} + NODE_DOCKER_PORT: ${{ secrets.NODE_DOCKER_PORT }} + GMAIL_OAUTH_USER: ${{ secrets.GMAIL_OAUTH_USER }} + GMAIL_OAUTH_CLIENT_ID: ${{ secrets.GMAIL_OAUTH_CLIENT_ID }} + GMAIL_OAUTH_CLIENT_SECRET: ${{ secrets.GMAIL_OAUTH_CLIENT_SECRET }} + GMAIL_OAUTH_REFRESH_TOKEN: ${{ secrets.GMAIL_OAUTH_REFRESH_TOKEN }} + AWS_S3_SECRET_KEY: ${{ secrets.AWS_S3_SECRET_KEY }} + AWS_S3_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY }} + AWS_S3_REGION: ${{ secrets.AWS_S3_REGION }} + AWS_BUCKET: ${{ secrets.AWS_BUCKET }} + PEXELS_API_KEY: ${{ secrets.PEXELS_API_KEY }} + + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v2 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Dependencies + run: npm install + + - name: Build + run: npm run build --if-present + + - name: Lint + run: npm run lint + + - name: Install AWS CLI + run: | + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" + unzip awscliv2.zip + sudo ./aws/install + + - name: Upload to AWS S3 + if: success() # 이전 단계가 성공했을 경우에만 실행 + run: | + aws s3 cp ./build s3://${{ secrets.AWS_BUCKET }}/ --recursive + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_KEY }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_S3_REGION }}