Merge pull request #122 from sparcs-kaist/fix@infinite-scroll #324
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main, migration, rc] | |
| pull_request: | |
| branches: [main, migration] | |
| release: | |
| types: [created] | |
| env: | |
| NODE_VERSION: 18 | |
| jobs: | |
| format-and-lint: | |
| name: Format and Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: yarn | |
| - name: Install yarn dependencies | |
| run: yarn install | |
| - name: Format | |
| run: yarn prettier | |
| - name: Lint | |
| run: yarn lint | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: yarn | |
| - name: Install yarn dependencies | |
| run: yarn install | |
| - name: Build | |
| run: yarn build | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: yarn | |
| - name: Install yarn dependencies | |
| run: yarn install | |
| - name: Run tests | |
| run: yarn coverage | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/[email protected] | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: sparcs-kaist/otlplus-web | |
| deploy-dev: | |
| name: Build and Deploy to Dev | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/rc' && github.event_name == 'push' | |
| needs: [format-and-lint, build, test] | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: yarn | |
| - name: Install yarn dependencies | |
| run: yarn install | |
| - name: Build | |
| run: yarn build | |
| env: | |
| VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN_DEV }} | |
| VITE_DEV_MODE: true | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ap-northeast-2 | |
| - name: Upload to S3 Dev | |
| run: | | |
| aws s3 sync build/ s3://otl-plus-dev/ --delete | |
| echo "Uploaded build files to S3 Dev: s3://otl-plus-dev/" | |
| release-and-upload: | |
| name: Build and Upload Release Asset | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' | |
| needs: [format-and-lint] | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: yarn | |
| - name: Install yarn dependencies | |
| run: yarn install | |
| - name: Build | |
| run: yarn build | |
| env: | |
| VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN_PROD }} | |
| VITE_DEV_MODE: false | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ap-northeast-2 # Seoul region, adjust as needed | |
| - name: Upload to S3 | |
| run: | | |
| aws s3 sync build/ s3://otl.sparcs.org-1/${{ github.event.release.tag_name }}/ --delete | |
| echo "Uploaded build files to S3: s3://otl.sparcs.org-1/${{ github.event.release.tag_name }}/" |