From 6d118de535d9127755cc4d07472a8078333c66a4 Mon Sep 17 00:00:00 2001 From: "Bernard \"BeroBurny\" Stojanovic" Date: Thu, 12 Dec 2024 17:33:40 +0700 Subject: [PATCH 1/4] update pages ci/cd --- .github/workflows/cd.yml | 34 ++++++++++++++++++--- .github/workflows/ci.yml | 64 +++++++++++++++++++++++++++++++++------- 2 files changed, 84 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ef41f1a..3080fe9 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -49,11 +49,37 @@ jobs: - name: Publish Docs to Cloudflare Pages if: ${{ steps.release.outputs.releases_created }} - uses: cloudflare/pages-action@v1 + uses: cloudflare/wrangler-action@v3 with: + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: 2238a825c5aca59233eab1f221f7aefb + command: pages deploy ./docs/build --project-name=sprinter-docs + + - name: Publish POC to Cloudflare Pages + if: ${{ steps.release.outputs.releases_created }} + uses: cloudflare/wrangler-action@v3 + with: + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: 2238a825c5aca59233eab1f221f7aefb + command: pages deploy ./web/.svelte-kit/cloudflare --project-name=sprinter-poc + + # old deployment + - name: Publish Docs to Cloudflare Pages (old project) + if: ${{ steps.release.outputs.releases_created }} + uses: cloudflare/wrangler-action@v3 + with: + gitHubToken: ${{ secrets.GITHUB_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: 2238a825c5aca59233eab1f221f7aefb - projectName: gopher-docs - directory: ./docs/build + command: pages deploy ./docs/build --project-name=gopher-docs + + - name: Publish POC to Cloudflare Pages (old project) + if: ${{ steps.release.outputs.releases_created }} + uses: cloudflare/wrangler-action@v3 + with: gitHubToken: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.head_ref || github.ref_name }} \ No newline at end of file + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: 2238a825c5aca59233eab1f221f7aefb + command: pages deploy ./web/.svelte-kit/cloudflare --project-name=gopher-poc \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 399e3b3..0af9aee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,21 +29,65 @@ jobs: run: 'yarn run test:unit' - name: "Integrations Tests" run: 'yarn run test:integrations' - - name: Publish POC to Cloudflare Pages - uses: cloudflare/pages-action@v1 + - name: Set branch name for Cloudflare Pages + id: cf-branch + run: | + if [[ "${{ github.ref_name }}" == "master" ]]; then + echo "CF_BRANCH_NAME=preview" >> $GITHUB_ENV + else + echo "CF_BRANCH_NAME=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV + fi + - name: Publish Docs to Cloudflare Pages + id: docs-publish + uses: cloudflare/wrangler-action@v3 with: + gitHubToken: ${{ secrets.GITHUB_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: 2238a825c5aca59233eab1f221f7aefb - projectName: gopher-poc - directory: ./web/.svelte-kit/cloudflare + command: pages deploy ./docs/build --project-name=sprinter-docs --branch=${{ env.CF_BRANCH_NAME }} + - name: Publish POC to Cloudflare Pages + id: poc-publish + uses: cloudflare/wrangler-action@v3 + with: gitHubToken: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.head_ref || github.ref_name }} - - name: Publish Preview Docs to Cloudflare Pages - uses: cloudflare/pages-action@v1 + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: 2238a825c5aca59233eab1f221f7aefb + command: pages deploy ./web/.svelte-kit/cloudflare --project-name=sprinter-poc --branch=${{ env.CF_BRANCH_NAME }} + - name: Generate Deployment Summary + run: | + echo "# 🚀 Deployment Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "| **Project** | **Preview URL** |" >> $GITHUB_STEP_SUMMARY + echo "| ----------------------- | ---------------- |" >> $GITHUB_STEP_SUMMARY + echo "| **Docs** | [View Docs -> ${{ steps.docs-publish.outputs.deployment-url }}](${{ steps.docs-publish.outputs.deployment-url }}) |" >> $GITHUB_STEP_SUMMARY + echo "| **POC** | [View POC -> ${{ steps.poc-publish.outputs.deployment-url }}](${{ steps.poc-publish.outputs.deployment-url }}) |" >> $GITHUB_STEP_SUMMARY + - name: Notify About Deployment + if: ${{ github.actor != 'dependabot[bot]' }} + uses: actions/github-script@v7 with: + script: | + const docsUrl = `**Docs:** [View Deployment -> ${{ steps.docs-publish.outputs.deployment-url }}](${{ steps.docs-publish.outputs.deployment-url }})`; + const pocUrl = `**POC:** [View Deployment -> ${{ steps.poc-publish.outputs.deployment-url }}](${{ steps.poc-publish.outputs.deployment-url }})`; + const message = `🚀 **Deployment Completed**\n\n${docsUrl}\n${pocUrl}`; + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: message, + }); + + # old deployment + - name: Publish Docs to Cloudflare Pages (old project) + uses: cloudflare/wrangler-action@v3 + with: + gitHubToken: ${{ secrets.GITHUB_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: 2238a825c5aca59233eab1f221f7aefb - projectName: gopher-docs-preview - directory: ./docs/build + command: pages deploy ./docs/build --project-name=gopher-docs --branch=${{ env.CF_BRANCH_NAME }} + - name: Publish POC to Cloudflare Pages (old project) + uses: cloudflare/wrangler-action@v3 + with: gitHubToken: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.head_ref || github.ref_name }} \ No newline at end of file + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: 2238a825c5aca59233eab1f221f7aefb + command: pages deploy ./web/.svelte-kit/cloudflare --project-name=gopher-poc --branch=${{ env.CF_BRANCH_NAME }} \ No newline at end of file From b30b0bdace7546df88d833571a6d6e871f57fa87 Mon Sep 17 00:00:00 2001 From: "Bernard \"BeroBurny\" Stojanovic" Date: Thu, 12 Dec 2024 17:33:54 +0700 Subject: [PATCH 2/4] manual docs deployment --- .github/workflows/deploy-docs.yml | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/deploy-docs.yml diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..640056b --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,55 @@ +name: Deploy Docs +on: + workflow_dispatch: + inputs: + environment: + description: 'Select deployment environment' + required: true + default: 'preview' + type: choice + options: + - production + - preview + +jobs: + manual-deploy-docs: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: 'https://registry.npmjs.org' + + - run: corepack enable + + - run: yarn install --immutable + + - run: yarn build + + - name: Set branch name for Cloudflare Pages + id: cf-branch + run: | + if [[ "${{ github.ref_name }}" == "production" ]]; then + echo "CF_BRANCH_NAME=master" >> $GITHUB_ENV + else + echo "CF_BRANCH_NAME=preview" >> $GITHUB_ENV + fi + + - name: Publish Docs to Cloudflare Pages + uses: cloudflare/wrangler-action@v3 + with: + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: 2238a825c5aca59233eab1f221f7aefb + command: pages deploy ./docs/build --project-name=sprinter-docs --branch=${{ env.CF_BRANCH_NAME }} + + - name: Publish Docs to Cloudflare Pages (old project) + uses: cloudflare/wrangler-action@v3 + with: + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: 2238a825c5aca59233eab1f221f7aefb + command: pages deploy ./docs/build --project-name=gopher-docs --branch=${{ env.CF_BRANCH_NAME }} \ No newline at end of file From 62e9447e4947256dea9ab893f56c52f88260cc6d Mon Sep 17 00:00:00 2001 From: "Bernard \"BeroBurny\" Stojanovic" Date: Thu, 12 Dec 2024 17:37:05 +0700 Subject: [PATCH 3/4] release please for docs --- .release-please-manifest.json | 1 + docs/package.json | 2 +- release-please-config.json | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c832155..8a125dc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,4 +1,5 @@ { + "docs": "0.0.1", "packages/sdk": "1.1.2", "packages/react": "1.1.2" } \ No newline at end of file diff --git a/docs/package.json b/docs/package.json index bd5ca3d..aac289b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "docs", - "version": "0.0.0", + "version": "0.0.1", "private": true, "scripts": { "docusaurus": "docusaurus", diff --git a/release-please-config.json b/release-please-config.json index 5642528..3422cc5 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,6 +1,15 @@ { "plugins": [], "packages": { + "docs": { + "releaseType": "node", + "draft": false, + "prerelease": false, + "bumpMinorPreMajor": false, + "bumpPatchForMinorPreMajor": false, + "changelogPath": "CHANGELOG.md", + "versioning": "default" + }, "packages/sdk": { "releaseType": "node", "draft": false, From c8cd24adb378bfe273179637d5c1a522b95afdc3 Mon Sep 17 00:00:00 2001 From: "Bernard \"BeroBurny\" Stojanovic" Date: Thu, 12 Dec 2024 17:37:54 +0700 Subject: [PATCH 4/4] yarn.... --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7c905aa..c5157f2 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "@types/eslint": "^8.56.11", "@types/node": "18.19.42", "eslint": "8.57.0", - "typescript": "^5.0.3", - "prettier": "^3.4.2" + "prettier": "^3.4.2", + "typescript": "^5.0.3" }, "volta": { "node": "20.17.0",