From 7a915e3202432c71c175ec625b76122a5c8f81fe Mon Sep 17 00:00:00 2001 From: Daniel McCartney Date: Sun, 7 May 2023 18:37:21 -0400 Subject: [PATCH] build: add PR and release workflows --- .github/workflows/web-pull-request.yml | 29 ++++++++++++++++++++++++++ .github/workflows/web-release.yml | 24 +++++++++++++++++++++ package.json | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/web-pull-request.yml create mode 100644 .github/workflows/web-release.yml diff --git a/.github/workflows/web-pull-request.yml b/.github/workflows/web-pull-request.yml new file mode 100644 index 0000000..c05783f --- /dev/null +++ b/.github/workflows/web-pull-request.yml @@ -0,0 +1,29 @@ +on: + pull_request: + paths: + - "web/**" + - ".github/**" +permissions: + checks: write + contents: read + pull-requests: write +jobs: + build_and_deploy_web_preview: + if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm install + working-directory: ./web + - run: npm run build + working-directory: ./web + env: + REACT_APP_ALCHEMY_KEY: "${{ secrets.ALCHEMY_KEY }}" + REACT_APP_WALLET_CONNECT_PROJECT_ID: "${{ secrets.WALLET_CONNECT_PROJECT_ID }}" + REACT_APP_ROCKET_SWEEP_URL: "https://rocketsweep.app" + GENERATE_SOURCEMAP: "false" + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: "${{ secrets.GITHUB_TOKEN }}" + firebaseServiceAccount: "${{ secrets.FIREBASE_PROD_SERVICE_ACCOUNT }}" + projectId: "${{ secrets.FIREBASE_PROD_PROJECT_ID }}" diff --git a/.github/workflows/web-release.yml b/.github/workflows/web-release.yml new file mode 100644 index 0000000..8aec28f --- /dev/null +++ b/.github/workflows/web-release.yml @@ -0,0 +1,24 @@ +on: + release: + types: [published] +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm install + working-directory: ./web + - run: npm run build + working-directory: ./web + env: + REACT_APP_ALCHEMY_KEY: "${{ secrets.ALCHEMY_KEY }}" + REACT_APP_WALLET_CONNECT_PROJECT_ID: "${{ secrets.WALLET_CONNECT_PROJECT_ID }}" + REACT_APP_ROCKET_SWEEP_URL: "https://rocketsweep.app" + GENERATE_SOURCEMAP: "false" + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: "${{ secrets.GITHUB_TOKEN }}" + firebaseServiceAccount: "${{ secrets.FIREBASE_PROD_SERVICE_ACCOUNT }}" + channelId: live + projectId: "${{ secrets.FIREBASE_PROD_PROJECT_ID }}" +# TODO: parallel job to pin to ipfs to https://rocketsweep.eth.limo diff --git a/package.json b/package.json index 403f1e3..3ec321f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "scripts": { - "pretty": "npx prettier '**/*.{sol,js}' --write" + "pretty": "npx prettier '**/*.{sol,js,yml}' --write" }, "devDependencies": { "prettier": "^2.8.8",