Skip to content
Merged
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
220 changes: 220 additions & 0 deletions .github/workflows/deployments.yml
Original file line number Diff line number Diff line change
@@ -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 }}
100 changes: 100 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 6 additions & 4 deletions scripts/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down