From dcba66fcc97a11cd8f07cf7100684713a65c9fbe Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Tue, 30 Jul 2024 17:18:48 +0200 Subject: [PATCH 1/2] Update workflows.ts --- src/helpers/workflows.ts | 100 +++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 41 deletions(-) diff --git a/src/helpers/workflows.ts b/src/helpers/workflows.ts index 242f458d..389fb3b5 100644 --- a/src/helpers/workflows.ts +++ b/src/helpers/workflows.ts @@ -129,56 +129,64 @@ on: repository_dispatch: types: [setup] workflow_dispatch: + +permissions: + id-token: write + pages: write + jobs: release: name: Setup Upptime - runs-on: ${config.runner || DEFAULT_RUNNER} + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: - ref: \${{ github.head_ref }} - token: \${{ secrets.GH_PAT || github.token }} + ref: ${{ github.head_ref }} + token: ${{ secrets.GH_PAT || github.token }} - name: Update template - uses: upptime/uptime-monitor@${await getUptimeMonitorVersion()} + uses: upptime/uptime-monitor@v1.37.0 with: command: "update-template" env: - GH_PAT: \${{ secrets.GH_PAT || github.token }} + GH_PAT: ${{ secrets.GH_PAT || github.token }} - name: Update response time - uses: upptime/uptime-monitor@${await getUptimeMonitorVersion()} + uses: upptime/uptime-monitor@v1.37.0 with: command: "response-time" env: - GH_PAT: \${{ secrets.GH_PAT || github.token }} - SECRETS_CONTEXT: \${{ toJson(secrets) }} + GH_PAT: ${{ secrets.GH_PAT || github.token }} + SECRETS_CONTEXT: ${{ toJson(secrets) }} - name: Update summary in README - uses: upptime/uptime-monitor@${await getUptimeMonitorVersion()} + uses: upptime/uptime-monitor@v1.37.0 with: command: "readme" env: - GH_PAT: \${{ secrets.GH_PAT || github.token }} + GH_PAT: ${{ secrets.GH_PAT || github.token }} - name: Generate graphs - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: Graphs CI - token: \${{ secrets.GH_PAT || github.token }} + uses: ./.github/workflows/graphs.yml - name: Generate site - uses: upptime/uptime-monitor@${await getUptimeMonitorVersion()} + uses: upptime/uptime-monitor@v1.37.0 with: command: "site" env: - GH_PAT: \${{ secrets.GH_PAT || github.token }} - - uses: peaceiris/actions-gh-pages@v4 - name: GitHub Pages Deploy + GH_PAT: ${{ secrets.GH_PAT || github.token }} + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - github_token: \${{ secrets.GH_PAT || github.token }} - publish_dir: "site/status-page/__sapper__/export/" - force_orphan: "${statusWebsite.singleCommit || false}" - user_name: "${commitMessages.commitAuthorName || "Upptime Bot"}" - user_email: "${ - commitMessages.commitAuthorEmail || "73812536+upptime-bot@users.noreply.github.com" - }" + path: site/status-page/__sapper__/export/ + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: [release] + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 `; }; @@ -193,37 +201,47 @@ export const siteCiWorkflow = async () => { name: Static Site CI on: schedule: - - cron: "${workflowSchedule.staticSite || STATIC_SITE_CI_SCHEDULE}" + - cron: "0 1 * * *" repository_dispatch: types: [static_site] workflow_dispatch: + +permissions: + id-token: write + pages: write + jobs: release: name: Build and deploy site - runs-on: ${config.runner || DEFAULT_RUNNER} - if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: - ref: \${{ github.head_ref }} - token: \${{ secrets.GH_PAT || github.token }} + ref: ${{ github.head_ref }} + token: ${{ secrets.GH_PAT || github.token }} - name: Generate site - uses: upptime/uptime-monitor@${await getUptimeMonitorVersion()} + uses: upptime/uptime-monitor@v1.37.0 with: command: "site" env: - GH_PAT: \${{ secrets.GH_PAT || github.token }} - - uses: peaceiris/actions-gh-pages@v4 - name: GitHub Pages Deploy + GH_PAT: ${{ secrets.GH_PAT || github.token }} + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - github_token: \${{ secrets.GH_PAT || github.token }} - publish_dir: "site/status-page/__sapper__/export/" - force_orphan: "${statusWebsite.singleCommit || false}" - user_name: "${commitMessages.commitAuthorName || "Upptime Bot"}" - user_email: "${ - commitMessages.commitAuthorEmail || "73812536+upptime-bot@users.noreply.github.com" - }" + path: site/status-page/__sapper__/export/ + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: [release] + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 `; }; From 571b5a3ec1fe096422962e4870eebc1d5a325597 Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Mon, 12 Aug 2024 16:19:19 +0200 Subject: [PATCH 2/2] Fix remaining issues --- src/helpers/workflows.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/helpers/workflows.ts b/src/helpers/workflows.ts index 389fb3b5..aa8af3aa 100644 --- a/src/helpers/workflows.ts +++ b/src/helpers/workflows.ts @@ -50,9 +50,8 @@ name: Graphs CI on: schedule: - cron: "${workflowSchedule.graphs || GRAPHS_CI_SCHEDULE}" - repository_dispatch: - types: [graphs] workflow_dispatch: + workflow_call: jobs: release: name: Generate graphs @@ -163,8 +162,6 @@ jobs: command: "readme" env: GH_PAT: ${{ secrets.GH_PAT || github.token }} - - name: Generate graphs - uses: ./.github/workflows/graphs.yml - name: Generate site uses: upptime/uptime-monitor@v1.37.0 with: @@ -176,7 +173,9 @@ jobs: - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: site/status-page/__sapper__/export/ + path: site/status-page/__sapper__/export/ + update_graphs: + uses: ./.github/workflows/graphs.yml deploy: environment: name: github-pages