diff --git a/.github/workflows/pr-testdeploy.yml b/.github/workflows/pr-testdeploy.yml new file mode 100644 index 0000000..f29fca8 --- /dev/null +++ b/.github/workflows/pr-testdeploy.yml @@ -0,0 +1,60 @@ +name: Upload pr to B (NOcanoa account) + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + upload: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install pnpm + run: npm install -g pnpm + + - name: Verify pnpm installation + run: pnpm --version + + - name: Install dependencies + run: pnpm install + + - name: Build project + run: pnpm run build + + - name: Deploy to BunnyCDN + uses: ayeressian/bunnycdn-storage-deploy@v2.2.4 + with: + source: "dist" + destination: "${{ github.event.number }}" + storageZoneName: "${{ secrets.STORAGE_NAME_PR }}" + storagePassword: "${{ secrets.STORAGE_PASSWORD_PR }}" + upload: "true" + remove: "false" + purgePullZone: "false" + + comment: + runs-on: ubuntu-latest + needs: upload + + steps: + - name: Comment on PR + uses: actions/github-script@v6 + with: + script: | + const pr_number = context.issue.number; + const deploymentUrl = `https://846463563435345453554545454.b-cdn.net/setup.html`; + const comment = `The deployment is complete for PR #${pr_number} 🎉\n\nSet the value to pr number [here](${deploymentUrl}), an then just reload to / \n\n verry work in progress xD`; + github.rest.issues.createComment({ + ...context.issue, + issue_number: pr_number, + body: comment + }); +