Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improved ci/cd #109

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
mpetrunic marked this conversation as resolved.
Show resolved Hide resolved

# 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 }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 2238a825c5aca59233eab1f221f7aefb
command: pages deploy ./web/.svelte-kit/cloudflare --project-name=gopher-poc
64 changes: 54 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 2238a825c5aca59233eab1f221f7aefb
command: pages deploy ./web/.svelte-kit/cloudflare --project-name=gopher-poc --branch=${{ env.CF_BRANCH_NAME }}
55 changes: 55 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -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 }}
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"docs": "0.0.1",
"packages/sdk": "1.1.2",
"packages/react": "1.1.2"
}
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "0.0.0",
"version": "0.0.1",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Loading