Skip to content

Commit c6188bb

Browse files
authored
chore: refactor cf pages ci/cd from gopher-*to sprinter-* (#100)
closes #76
1 parent 616af97 commit c6188bb

File tree

2 files changed

+51
-16
lines changed

2 files changed

+51
-16
lines changed

.github/workflows/cd.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,18 @@ jobs:
4949

5050
- name: Publish Docs to Cloudflare Pages
5151
if: ${{ steps.release.outputs.releases_created }}
52-
uses: cloudflare/pages-action@v1
52+
uses: cloudflare/wrangler-action@v3
5353
with:
54+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
5455
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
5556
accountId: 2238a825c5aca59233eab1f221f7aefb
56-
projectName: gopher-docs-preview
57-
directory: ./docs/build
57+
command: pages deploy ./docs/build --project-name=sprinter-docs
58+
59+
- name: Publish POC to Cloudflare Pages
60+
if: ${{ steps.release.outputs.releases_created }}
61+
uses: cloudflare/wrangler-action@v3
62+
with:
5863
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
59-
branch: ${{ github.head_ref || github.ref_name }}
64+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
65+
accountId: 2238a825c5aca59233eab1f221f7aefb
66+
command: pages deploy ./web/.svelte-kit/cloudflare --project-name=sprinter-poc

.github/workflows/ci.yml

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,49 @@ jobs:
2929
run: 'yarn run test:unit'
3030
- name: "Integrations Tests"
3131
run: 'yarn run test:integrations'
32-
- name: Publish POC to Cloudflare Pages
33-
uses: cloudflare/pages-action@v1
32+
- name: Set branch name for Cloudflare Pages
33+
id: cf-branch
34+
run: |
35+
if [[ "${{ github.ref_name }}" == "master" ]]; then
36+
echo "CF_BRANCH_NAME=preview" >> $GITHUB_ENV
37+
else
38+
echo "CF_BRANCH_NAME=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV
39+
fi
40+
- name: Publish Docs to Cloudflare Pages
41+
id: docs-publish
42+
uses: cloudflare/wrangler-action@v3
3443
with:
44+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
3545
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
3646
accountId: 2238a825c5aca59233eab1f221f7aefb
37-
projectName: gopher-poc
38-
directory: ./web/.svelte-kit/cloudflare
39-
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
40-
branch: ${{ github.head_ref || github.ref_name }}
41-
- name: Publish Preview Docs to Cloudflare Pages
42-
uses: cloudflare/pages-action@v1
47+
command: pages deploy ./docs/build --project-name=sprinter-docs --branch=${{ env.CF_BRANCH_NAME }}
48+
- name: Publish POC to Cloudflare Pages
49+
id: poc-publish
50+
uses: cloudflare/wrangler-action@v3
4351
with:
52+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
4453
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
4554
accountId: 2238a825c5aca59233eab1f221f7aefb
46-
projectName: gopher-docs-preview
47-
directory: ./docs/build
48-
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
49-
branch: ${{ github.head_ref || github.ref_name }}
55+
command: pages deploy ./web/.svelte-kit/cloudflare --project-name=sprinter-poc --branch=${{ env.CF_BRANCH_NAME }}
56+
- name: Generate Deployment Summary
57+
run: |
58+
echo "# 🚀 Deployment Summary" >> $GITHUB_STEP_SUMMARY
59+
echo "" >> $GITHUB_STEP_SUMMARY
60+
echo "| **Project** | **Preview URL** |" >> $GITHUB_STEP_SUMMARY
61+
echo "| ----------------------- | ---------------- |" >> $GITHUB_STEP_SUMMARY
62+
echo "| **Docs** | [View Docs -> ${{ steps.docs-publish.outputs.deployment-url }}](${{ steps.docs-publish.outputs.deployment-url }}) |" >> $GITHUB_STEP_SUMMARY
63+
echo "| **POC** | [View POC -> ${{ steps.poc-publish.outputs.deployment-url }}](${{ steps.poc-publish.outputs.deployment-url }}) |" >> $GITHUB_STEP_SUMMARY
64+
- name: Notify About Deployment
65+
if: ${{ github.actor != 'dependabot[bot]' }}
66+
uses: actions/github-script@v7
67+
with:
68+
script: |
69+
const docsUrl = `**Docs:** [View Deployment -> ${{ steps.docs-publish.outputs.deployment-url }}](${{ steps.docs-publish.outputs.deployment-url }})`;
70+
const pocUrl = `**POC:** [View Deployment -> ${{ steps.poc-publish.outputs.deployment-url }}](${{ steps.poc-publish.outputs.deployment-url }})`;
71+
const message = `🚀 **Deployment Completed**\n\n${docsUrl}\n${pocUrl}`;
72+
await github.rest.issues.createComment({
73+
issue_number: context.issue.number,
74+
owner: context.repo.owner,
75+
repo: context.repo.repo,
76+
body: message,
77+
});

0 commit comments

Comments
 (0)