From 428a89366f8c4d3c4c78dcd35112827b09c389e2 Mon Sep 17 00:00:00 2001 From: 0xdef1cafe <88504456+0xdef1cafe@users.noreply.github.com> Date: Tue, 28 Feb 2023 10:29:47 -0700 Subject: [PATCH] chore: cloudflare CI things --- .github/workflows/bootstrap.yml | 1 + .github/workflows/cloudflare.yml | 20 ++++++++++++++------ scripts/release.ts | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml index f843f4be04f..a9ae26a74da 100644 --- a/.github/workflows/bootstrap.yml +++ b/.github/workflows/bootstrap.yml @@ -42,4 +42,5 @@ jobs: call-cloudflare-workflow: name: Call uses: ./.github/workflows/cloudflare.yml + secrets: inherit # pass org/repo secrets to the called workflow needs: [install-and-cache] diff --git a/.github/workflows/cloudflare.yml b/.github/workflows/cloudflare.yml index 54a046fec45..5d28ab46ad8 100644 --- a/.github/workflows/cloudflare.yml +++ b/.github/workflows/cloudflare.yml @@ -3,15 +3,16 @@ on: jobs: deploy: - if: contains(fromJSON('["develop", "release", "yeet", "main", "private"]'), ${{ github.ref_name }}) + env: + # head_ref is current branch name + # https://docs.github.com/en/actions/learn-github-actions/contexts#example-contents-of-the-github-context + GITHUB_BRANCH_NAME: ${{ github.head_ref }} + if: contains(fromJSON('["develop", "release", "yeet", "main", "private"]'), ${{ github.head_ref }}) runs-on: size-bertha permissions: contents: read deployments: write name: Build - env: - # ref_name is branch name https://docs.github.com/en/actions/learn-github-actions/contexts#example-contents-of-the-github-context - GITHUB_BRANCH_NAME: ${{ github.ref_name }} steps: - name: Checkout uses: actions/checkout@v3 @@ -20,6 +21,14 @@ jobs: with: node-version-file: '.nvmrc' cache: 'yarn' + - name: Cache + uses: actions/cache@v3 + with: + path: | + node_modules + ~/.cache/Cypress + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} - name: Yarn Install run: yarn install --frozen-lockfile - name: Build @@ -29,7 +38,6 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - projectName: web-29e # e.g. 'my-project' + projectName: web # e.g. 'my-project' directory: build # e.g. 'dist' - gitHubToken: ${{ secrets.GITHUB_TOKEN }} branch: ${{ env.GITHUB_BRANCH_NAME }} diff --git a/scripts/release.ts b/scripts/release.ts index 021efb240d1..b4c4973d273 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -60,7 +60,7 @@ const createDraftPR = async (): Promise => { const { messages } = await getCommits('release') // TODO(0xdef1cafe): parse version bump from commit messages const nextVersion = await getNextReleaseVersion('minor') - const title = `chore: release ${nextVersion} [DO NOT MERGE]` + const title = `chore: release ${nextVersion}` const command = `gh pr create --draft --base "main" --title "${title}" --body "${messages}"` console.log(chalk.green('Creating draft PR...')) await pify(exec)(command)