From ec6c0ad94e0850b936fb49f570e5638f623ea9c3 Mon Sep 17 00:00:00 2001 From: Korrrba Date: Thu, 5 Oct 2023 20:09:12 +0200 Subject: [PATCH 1/3] chore: move deploy-logger-page workflow from ubiquibot repo Resolves: #712 --- .github/workflows/cloudflare-deploy.yml | 48 ------------------------ .github/workflows/deploy-logger-page.yml | 37 ++++++++++++++++++ 2 files changed, 37 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/cloudflare-deploy.yml create mode 100644 .github/workflows/deploy-logger-page.yml diff --git a/.github/workflows/cloudflare-deploy.yml b/.github/workflows/cloudflare-deploy.yml deleted file mode 100644 index cacda75..0000000 --- a/.github/workflows/cloudflare-deploy.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Deploy to Cloudflare Pages - -on: - workflow_run: - workflows: ["Conventional Commits"] - types: - - completed - -jobs: - deploy-to-cloudflare: - name: Deploy to Cloudflare Pages - runs-on: ubuntu-22.04 - permissions: - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "20.3.0" - - - name: Yarn Install - run: yarn install - - - name: Wrangler Install - run: npm install -g wrangler - - - name: Publish to Cloudflare - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - REPOSITORY: ${{ github.repository }} - PRODUCTION_BRANCH: "development" - OUTPUT_DIRECTORY: "static" - run: | - IFS='/' read -ra fields <<< "$REPOSITORY" - projectName="${fields[1]}" - echo $projectName - wrangler pages project list > project_list.txt - if grep -q $projectName project_list.txt; then - echo "Project found" - else - echo "Project not found" - wrangler pages project create "$projectName" --production-branch "$PRODUCTION_BRANCH" - fi - wrangler pages publish "$OUTPUT_DIRECTORY" --project-name "$projectName" diff --git a/.github/workflows/deploy-logger-page.yml b/.github/workflows/deploy-logger-page.yml new file mode 100644 index 0000000..73275f3 --- /dev/null +++ b/.github/workflows/deploy-logger-page.yml @@ -0,0 +1,37 @@ +name: Deploy Log Web App to Cloudflare Worker + +on: + workflow_run: + workflows: ["Conventional Commits"] + types: + - completed + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + name: Deploy to Cloudflare Worker + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "20.3.0" + + - name: Build TypeScript + run: npm install && npm run build + + - name: Publish to Cloudflare Pages + uses: cloudflare/pages-action@v1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }} + directory: ${{ secrets.LOGGER_WEB_APP_DIRECTORY }} + # Enable Wrangler v3 + wranglerVersion: "3" From 4241a09a73af4579e1a8965547b2e35a81ae01a6 Mon Sep 17 00:00:00 2001 From: Korrrba Date: Fri, 6 Oct 2023 07:44:17 +0200 Subject: [PATCH 2/3] chore: upgrade node in deploy logger workflow to the latest stable 20.8.0 version --- .github/workflows/deploy-logger-page.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-logger-page.yml b/.github/workflows/deploy-logger-page.yml index 73275f3..c0c3fe2 100644 --- a/.github/workflows/deploy-logger-page.yml +++ b/.github/workflows/deploy-logger-page.yml @@ -21,7 +21,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: "20.3.0" + node-version: "20.8.0" - name: Build TypeScript run: npm install && npm run build From 563e34d4c3228b196c2b91656fb4a124b0c7b340 Mon Sep 17 00:00:00 2001 From: Korrrba Date: Mon, 9 Oct 2023 12:06:04 +0200 Subject: [PATCH 3/3] chore: use generic deploy workflow Resolves: #712 --- .github/workflows/continuous-deploy.yml | 21 ++++++++++++++ .github/workflows/deploy-logger-page.yml | 37 ------------------------ 2 files changed, 21 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/continuous-deploy.yml delete mode 100644 .github/workflows/deploy-logger-page.yml diff --git a/.github/workflows/continuous-deploy.yml b/.github/workflows/continuous-deploy.yml new file mode 100644 index 0000000..d2c855b --- /dev/null +++ b/.github/workflows/continuous-deploy.yml @@ -0,0 +1,21 @@ +name: Deploy to Cloudflare Pages + +on: + workflow_run: + workflows: ["Build"] + types: + - completed + +jobs: + deploy-to-cloudflare: + name: Deploy to Cloudflare Pages + if: ${{ github.event.workflow_run.conclusion == 'success' }} + uses: ubiquity/.github/.github/workflows/deploy.yml@main + permissions: + contents: read + pull-requests: write + secrets: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + UBIQUITY_BOUNTY_BOT_APP_ID: ${{ secrets.UBIQUITY_BOUNTY_BOT_APP_ID }} + UBIQUITY_BOUNTY_BOT_PRIVATE_KEY: ${{ secrets.UBIQUITY_BOUNTY_BOT_PRIVATE_KEY }} diff --git a/.github/workflows/deploy-logger-page.yml b/.github/workflows/deploy-logger-page.yml deleted file mode 100644 index c0c3fe2..0000000 --- a/.github/workflows/deploy-logger-page.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Deploy Log Web App to Cloudflare Worker - -on: - workflow_run: - workflows: ["Conventional Commits"] - types: - - completed - -jobs: - publish: - runs-on: ubuntu-latest - permissions: - contents: read - deployments: write - name: Deploy to Cloudflare Worker - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "20.8.0" - - - name: Build TypeScript - run: npm install && npm run build - - - name: Publish to Cloudflare Pages - uses: cloudflare/pages-action@v1 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }} - directory: ${{ secrets.LOGGER_WEB_APP_DIRECTORY }} - # Enable Wrangler v3 - wranglerVersion: "3"