diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..0b7845f --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,45 @@ +name: Pull Request Build +on: pull_request + +env: + PROJECT_ID: bcsol-a8522 + +jobs: + + deployPreview: + runs-on: ubuntu-latest + environment: Preview + + outputs: + version: ${{ steps.version.outputs.version }} + + steps: + # setup + - uses: actions/checkout@v3 + - name: Use Node.js 16.x (LTS) + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: npm + - run: npm ci + + # test + # TODO + # - run: npm test + # - run: npm run lint + + # build + - run: npm run build + env: + # GENERATE_SOURCEMAP: false + REACT_APP_VERSION: "PREVIEW (PR #${{ github.event.number }})" + REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + + # deploy + - id: deploy + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: "${{ secrets.GITHUB_TOKEN }}" + firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}" + projectId: "${{ env.PROJECT_ID }}" + expires: 5d \ No newline at end of file diff --git a/.github/workflows/pull-request.yml.ignore b/.github/workflows/pull-request.yml.ignore deleted file mode 100644 index 712ac83..0000000 --- a/.github/workflows/pull-request.yml.ignore +++ /dev/null @@ -1,26 +0,0 @@ -# TODO -# name: Pull request preview -# on: pull_request - -# jobs: -# deployPreview: -# if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v2 -# - name: Use Node.js 16.x (LTS) -# uses: actions/setup-node@v3 -# with: -# node-version: 16.x -# # test & build -# - run: npm ci -# # TODO -# # - run: npm test -# # - run: npm run lint -# - run: npm run build -# # deploy -# - uses: FirebaseExtended/action-hosting-deploy@v0 -# with: -# repoToken: '${{ secrets.GITHUB_TOKEN }}' -# firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_BCSOL_A8522 }}' -# projectId: bcsol-a8522