Skip to content

πŸŒ’ Remix Nightly Release #402

πŸŒ’ Remix Nightly Release

πŸŒ’ Remix Nightly Release #402

Workflow file for this run

name: πŸŒ’ Remix Nightly Release
on:
workflow_dispatch:
schedule:
- cron: "0 8 * * *"
pull_request:
types: [closed]
branches:
- main
paths:
- "package.json"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
env:
CI: true
BRANCH_NAME: "actions/remix-nightly"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
bump:
name: πŸ“¦ Bump Remix to latest nightly
if: github.repository == 'mcansh/mcan.sh'
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: βŽ” Enable corepack
run: corepack enable
- name: βŽ” Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: 🟧 Install dependencies
run: pnpm install --recursive --frozen-lockfile --strict-peer-dependencies
- name: πŸ“¦ Bump Remix to latest nightly
id: bump
run: |
# reset the branch back to main
git reset --hard origin/main
# get the installed version of @remix-run/react
PREV_VERSION=$(npm ls --depth=0 @remix-run/react --json | jq -r '.dependencies["@remix-run/react"].version')
# if prev_version is not a nightly or experimental release, we'll need to scope it to the `remix@` tag prefix
if [[ $PREV_VERSION != *"nightly"* && $PREV_VERSION != *"experimental"* ]]; then
PREV_VERSION="remix@$PREV_VERSION"
else
# otherwise, we'll need to prefix it with `v`
PREV_VERSION="v$PREV_VERSION"
fi
# get the latest nightly version of @remix-run/react
VERSION=v$(npm info @remix-run/react dist-tags.nightly)
# upgrade @remix-run/* to the latest nightly
npx --yes upgrade-remix@latest $VERSION
# format the lockfile
npm run format
# check if there are any changes
if [ "$(git status --porcelain)" ]; then
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "prev_version=$PREV_VERSION" >> $GITHUB_OUTPUT
fi
- name: πŸ“€ Push changes
if: steps.bump.outputs.version != '' && steps.bump.outputs.prev_version != ''
run: |
PR_URL="$(gh pr list --head "$BRANCH_NAME" --state open --json url --jq .[].url)"
# if we already have a PR, we'll drop the last commit and force push the new one
if [[ -n "${PR_URL}" ]]; then
echo "PR already exists -> ${PR_URL}"
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add .
git commit --amend --no-edit
git push origin HEAD:$BRANCH_NAME --force-with-lease
gh pr edit ${PR_URL} --title "chore(deps): bump \`@remix-run/*\` to ${{ steps.bump.outputs.version }}" --body "This PR bumps \`@remix-run/*\` to the latest nightly release. For a list of changes, see the list of [changes](https://github.com/remix-run/remix/compare/${{ steps.bump.outputs.prev_version }}...${{ steps.bump.outputs.version }})."
else
echo "PR doesn't exist, creating a new one"
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add .
git commit -m "chore(deps): bump \`@remix-run/*\` to ${{ steps.bump.outputs.version }}"
git push origin HEAD:$BRANCH_NAME
gh pr create --title "chore(deps): bump \`@remix-run/*\` to ${{ steps.bump.outputs.version }}" --body "This PR bumps \`@remix-run/*\` to the latest nightly release. For a list of changes, see the list of [changes](https://github.com/remix-run/remix/compare/${{ steps.bump.outputs.prev_version }}...${{ steps.bump.outputs.version }})."
fi