From 60b663d53c595faec905d83aba5c059690d46915 Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Fri, 6 Sep 2024 02:59:13 -0700 Subject: [PATCH] Update github actions --- .github/workflows/publish-dashboard.yaml | 4 +- .github/workflows/publish-lander.yaml | 69 +++++++++++++++++++++++ .github/workflows/publish-superadmin.yaml | 69 +++++++++++++++++++++++ .husky/pre-push | 10 ++-- 4 files changed, 145 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/publish-lander.yaml create mode 100644 .github/workflows/publish-superadmin.yaml diff --git a/.github/workflows/publish-dashboard.yaml b/.github/workflows/publish-dashboard.yaml index 44ce2e07..f74c0dc4 100644 --- a/.github/workflows/publish-dashboard.yaml +++ b/.github/workflows/publish-dashboard.yaml @@ -3,6 +3,7 @@ name: Publish Dashboard to Cloudflare Pages on: push: paths: + - .github/workflows/publish-dashboard.yaml - packages/dashboard/** env: @@ -33,8 +34,7 @@ jobs: - name: Prepare build run: | pnpm i - pnpm lint - cd dashboard + cd packages/dashboard pnpm build - name: Expose git commit data diff --git a/.github/workflows/publish-lander.yaml b/.github/workflows/publish-lander.yaml new file mode 100644 index 00000000..035bf2fe --- /dev/null +++ b/.github/workflows/publish-lander.yaml @@ -0,0 +1,69 @@ +name: Publish Lander to Cloudflare Pages + +on: + push: + paths: + - .github/workflows/publish-lander.yaml + - packages/lander/** + +env: + PUBLIC_APEX_DOMAIN: ${{ vars.PUBLIC_APEX_DOMAIN }} + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + name: Publish to Cloudflare Pages + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + + - name: pnpm + uses: pnpm/action-setup@v3.0.0 + with: + version: 9.9.0 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: 'pnpm' + + - name: Prepare build + run: | + pnpm i + cd packages/lander + pnpm build + + - name: Expose git commit data + uses: rlespinasse/git-commit-data-action@v1.5.0 + + - name: Publish to Cloudflare Pages + uses: cloudflare/pages-action@v1.5.0 + id: deployment + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: pockethost-lander + directory: ./dist/lander + branch: ${{ github.head_ref || github.ref_name }} + wranglerVersion: '3' + + - name: Discord feature branch notification + if: github.ref_name != 'master' + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@master + with: + args: '**LANDER PREVIEW** ${{ steps.deployment.outputs.url }} was generated by ${{ github.actor }} in [${{ env.GIT_COMMIT_SHORT_SHA }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }}) with memo `${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}`' + + - name: Discord live branch notification + if: github.ref_name == 'master' + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@master + with: + args: '**LANDER LIVE** https://app.pockethost.io ([permalink](${{ steps.deployment.outputs.url }})) was updated by ${{ github.actor }} in [${{ env.GIT_COMMIT_SHORT_SHA }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }}): `${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}`' diff --git a/.github/workflows/publish-superadmin.yaml b/.github/workflows/publish-superadmin.yaml new file mode 100644 index 00000000..7175e185 --- /dev/null +++ b/.github/workflows/publish-superadmin.yaml @@ -0,0 +1,69 @@ +name: Publish Superadmin to Cloudflare Pages + +on: + push: + paths: + - .github/workflows/publish-superadmin.yaml + - packages/superadmin/** + +env: + PUBLIC_APEX_DOMAIN: ${{ vars.PUBLIC_APEX_DOMAIN }} + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + name: Publish to Cloudflare Pages + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + + - name: pnpm + uses: pnpm/action-setup@v3.0.0 + with: + version: 9.9.0 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: 'pnpm' + + - name: Prepare build + run: | + pnpm i + cd packages/superadmin + pnpm build + + - name: Expose git commit data + uses: rlespinasse/git-commit-data-action@v1.5.0 + + - name: Publish to Cloudflare Pages + uses: cloudflare/pages-action@v1.5.0 + id: deployment + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: pockethost-superadmin + directory: ./dist/superadmin + branch: ${{ github.head_ref || github.ref_name }} + wranglerVersion: '3' + + - name: Discord feature branch notification + if: github.ref_name != 'master' + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@master + with: + args: '**SUPERADMIN PREVIEW** ${{ steps.deployment.outputs.url }} was generated by ${{ github.actor }} in [${{ env.GIT_COMMIT_SHORT_SHA }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }}) with memo `${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}`' + + - name: Discord live branch notification + if: github.ref_name == 'master' + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@master + with: + args: '**SUPERADMIN LIVE** https://app.pockethost.io ([permalink](${{ steps.deployment.outputs.url }})) was updated by ${{ github.actor }} in [${{ env.GIT_COMMIT_SHORT_SHA }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }}): `${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}`' diff --git a/.husky/pre-push b/.husky/pre-push index 02b59ee9..6f8c1841 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,6 +1,6 @@ -branch="$(git rev-parse --abbrev-ref HEAD)" -if [ "$branch" = "v0/main" ]; then - pnpm -r check:types - pnpm -r build -fi +# branch="$(git rev-parse --abbrev-ref HEAD)" +# if [ "$branch" = "v0/main" ]; then +# pnpm -r check:types +# pnpm -r build +# fi