From 61be7037c5d991386cf0447b1cb253c71c1c4e81 Mon Sep 17 00:00:00 2001 From: Logan McAnsh Date: Wed, 13 Apr 2022 17:24:15 -0400 Subject: [PATCH 1/2] ci: more nightly updates (#2780) (cherry picked from commit 8c071d706e734f8ead289d902031ba5676870e9f) --- .github/workflows/nightly.yml | 100 ++++++++++++++++++++++++++++++++++ scripts/version.js | 10 ++-- 2 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000000..c5cd3c9f849 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,100 @@ +name: ๐ŸŒ’ Nightly Release + +on: + schedule: + - cron: "0 7 * * *" # every day at 12AM PST + +jobs: + nightly: + name: ๐ŸŒ’ Nightly Release + if: github.repository == 'remix-run/remix' + runs-on: ubuntu-latest + outputs: + # allows this to be used in the `comment` job below + NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }} + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + with: + ref: dev + # checkout using a custom token so that we can push later on + token: ${{ secrets.NIGHTLY_PAT }} + fetch-depth: 0 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + cache: "yarn" + + - name: ๐Ÿ“ฅ Install deps + # even though this is called "npm-install" it does use yarn to install + # because we have a yarn.lock and caches efficiently. + uses: bahmutov/npm-install@v1 + + - name: ๐Ÿ— Build + run: yarn build + + - name: โคด๏ธ Update Version + id: version + run: | + SHA=$(git rev-parse HEAD) + SHORT_SHA=${SHA::7} + DATE=$(date '+%Y%m%d') + NEXT_VERSION=0.0.0-nightly-${SHORT_SHA}-${DATE} + echo ::set-output name=NEXT_VERSION::${NEXT_VERSION} + + git checkout -b nightly/${NEXT_VERSION} + + if [ -z "$(git status --porcelain)" ]; then + echo "โœจ" + else + echo "dirty working directory..." + git add . + git commit -m "dirty working directory..." + fi + + yarn run version ${NEXT_VERSION} --skip-prompt + + git push origin --tags + + - name: ๐Ÿ” Setup npm auth + run: | + echo "registry=https://registry.npmjs.org" >> ~/.npmrc + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc + + - name: ๐Ÿš€ Publish + run: npm run publish --tag nightly + + - name: ๐Ÿฑ Create GitHub release + uses: actions/create-release@v1 + with: + draft: false + prerelease: true + release_name: v${{ steps.version.outputs.NEXT_VERSION }} + tag_name: v${{ steps.version.outputs.NEXT_VERSION }} + env: + # need this token in order to have it trigger the comment and deployment test workflows + GITHUB_TOKEN: ${{ secrets.NIGHTLY_PAT }} + + comment: + needs: [nightly] + name: Comment on Issues and PRs + if: github.repository == 'remix-run/remix' + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›ด Kick off comment and deployment test workflows + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + EVENT_TYPE: release + REPO: remix-run/remix + VERSION: refs/tags/v${{ needs.nightly.outputs.NEXT_VERSION }} + run: | + curl \ + -H "Authorization: token ${GITHUB_TOKEN}" \ + --request POST \ + --data '{ "event_type": "${EVENT_TYPE}", "client_payload": { "ref": "${VERSION}" } }' \ + https://api.github.com/repos/${REPO}/dispatches diff --git a/scripts/version.js b/scripts/version.js index 9de93776b0e..da96e84f5c1 100644 --- a/scripts/version.js +++ b/scripts/version.js @@ -35,10 +35,12 @@ async function run(args) { } // Confirm the next version number - let answer = await prompt( - `Are you sure you want to bump version ${currentVersion} to ${nextVersion}? [Yn] ` - ); - if (answer === false) return 0; + if (prereleaseId !== "--skip-prompt") { + let answer = await prompt( + `Are you sure you want to bump version ${currentVersion} to ${nextVersion}? [Yn] ` + ); + if (answer === false) return 0; + } await incrementRemixVersion(nextVersion); } From cbd42c9e054be6aa2dccdeca276c008f6cfee0b7 Mon Sep 17 00:00:00 2001 From: Logan McAnsh Date: Thu, 14 Apr 2022 15:57:05 -0400 Subject: [PATCH 2/2] ci: opt out of caching deployment test dependencies (#2789) (cherry picked from commit a7c6a49526b440d4304136bec6392f53cbeb79f1) Signed-off-by: Logan McAnsh --- .github/workflows/deployments.yml | 220 ++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 .github/workflows/deployments.yml diff --git a/.github/workflows/deployments.yml b/.github/workflows/deployments.yml new file mode 100644 index 00000000000..b5c7ad738db --- /dev/null +++ b/.github/workflows/deployments.yml @@ -0,0 +1,220 @@ +name: ๐Ÿš€ Deployment Tests + +on: + repository_dispatch: + types: [release] + +jobs: + arc_deploy: + name: Architect Deploy + if: github.repository == 'remix-run/remix' + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + + # some deployment targets require the latest version of npm + # TODO: remove this eventually when the default version we get + # is "latest" enough. + - name: ๐Ÿ“ฆ Install latest version of npm + run: npm install -g npm@latest + working-directory: ./scripts/deployment-test + + - name: ๐Ÿ“ฅ Install deployment-test deps + uses: bahmutov/npm-install@v1 + with: + working-directory: ./scripts/deployment-test + + - name: ๐Ÿš€ Deploy to Arc + run: node ./arc.mjs + working-directory: ./scripts/deployment-test + env: + CI: true + AWS_ACCESS_KEY_ID: ${{ secrets.TEST_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_AWS_SECRET_ACCESS_KEY }} + + cf_pages_deploy: + name: "CF Pages Deploy" + if: github.repository == 'remix-run/remix' + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + + # some deployment targets require the latest version of npm + # TODO: remove this eventually when the default version we get + # is "latest" enough. + - name: ๐Ÿ“ฆ Install latest version of npm + run: npm install -g npm@latest + working-directory: ./scripts/deployment-test + + - name: ๐Ÿ“ฅ Install deployment-test deps + uses: bahmutov/npm-install@v1 + with: + working-directory: ./scripts/deployment-test + + - name: ๐Ÿš€ Deploy to Cloudflare Pages + run: node ./cf-pages.mjs + working-directory: ./scripts/deployment-test + env: + CF_ACCOUNT_ID: ${{ secrets.TEST_CF_ACCOUNT_ID }} + CF_GLOBAL_API_KEY: ${{ secrets.TEST_CF_GLOBAL_API_KEY }} + CF_EMAIL: ${{ secrets.TEST_CF_EMAIL }} + GITHUB_TOKEN: ${{ secrets.TEST_CF_GITHUB_TOKEN }} + + cf_workers_deploy: + name: "CF Workers Deploy" + if: github.repository == 'remix-run/remix' + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + + # some deployment targets require the latest version of npm + # TODO: remove this eventually when the default version we get + # is "latest" enough. + - name: ๐Ÿ“ฆ Install latest version of npm + run: npm install -g npm@latest + working-directory: ./scripts/deployment-test + + - name: ๐Ÿ“ฅ Install deployment-test deps + uses: bahmutov/npm-install@v1 + with: + working-directory: ./scripts/deployment-test + + - name: ๐Ÿš€ Deploy to Cloudflare Workers + run: node ./cf-workers.mjs + working-directory: ./scripts/deployment-test + env: + CF_ACCOUNT_ID: ${{ secrets.TEST_CF_ACCOUNT_ID }} + CF_API_TOKEN: ${{ secrets.TEST_CF_API_TOKEN }} + + fly_deploy: + name: "Fly Deploy" + if: github.repository == 'remix-run/remix' + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + + # some deployment targets require the latest version of npm + # TODO: remove this eventually when the default version we get + # is "latest" enough. + - name: ๐Ÿ“ฆ Install latest version of npm + run: npm install -g npm@latest + working-directory: ./scripts/deployment-test + + - name: ๐Ÿ“ฅ Install deployment-test deps + uses: bahmutov/npm-install@v1 + with: + working-directory: ./scripts/deployment-test + + - name: ๐ŸŽˆ Install the Fly CLI + run: curl -L https://fly.io/install.sh | FLYCTL_INSTALL=/usr/local sh + + - name: ๐Ÿš€ Deploy to Fly + run: node ./fly.mjs + working-directory: ./scripts/deployment-test + env: + FLY_API_TOKEN: ${{ secrets.TEST_FLY_TOKEN }} + + netlify_deploy: + name: "Netlify Deploy" + if: github.repository == 'remix-run/remix' + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + + # some deployment targets require the latest version of npm + # TODO: remove this eventually when the default version we get + # is "latest" enough. + - name: ๐Ÿ“ฆ Install latest version of npm + run: npm install -g npm@latest + working-directory: ./scripts/deployment-test + + - name: ๐Ÿ“ฅ Install deployment-test deps + uses: bahmutov/npm-install@v1 + with: + working-directory: ./scripts/deployment-test + + - name: ๐Ÿš€ Deploy to Netlify + run: node ./netlify.mjs + working-directory: ./scripts/deployment-test + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.TEST_NETLIFY_TOKEN }} + + vercel_deploy: + name: "Vercel Deploy" + if: github.repository == 'remix-run/remix' + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + + # some deployment targets require the latest version of npm + # TODO: remove this eventually when the default version we get + # is "latest" enough. + - name: ๐Ÿ“ฆ Install latest version of npm + run: npm install -g npm@latest + working-directory: ./scripts/deployment-test + + - name: ๐Ÿ“ฅ Install deployment-test deps + uses: bahmutov/npm-install@v1 + with: + working-directory: ./scripts/deployment-test + + - name: ๐Ÿš€ Deploy to Vercel + run: node ./vercel.mjs + working-directory: ./scripts/deployment-test + env: + VERCEL_TOKEN: ${{ secrets.TEST_VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.TEST_VERCEL_USER_ID }}