Skip to content

Commit

Permalink
Revert "ci: dont cut a nightly if the latest dev commit was the last …
Browse files Browse the repository at this point in the history
…nightly"

this was meant to be a PR 🤦‍♂️

This reverts commit 1084573.
  • Loading branch information
mcansh committed Jun 14, 2022
1 parent 1084573 commit 4b2114e
Showing 1 changed file with 17 additions and 39 deletions.
56 changes: 17 additions & 39 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
if: github.repository == 'remix-run/remix'
runs-on: ubuntu-latest
outputs:
# allows this to be used in the `comment` job below - will be undefined if there's no release necessary
# allows this to be used in the `comment` job below
NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }}
steps:
- name: 🛑 Cancel Previous Runs
Expand All @@ -40,68 +40,46 @@ jobs:
# because we have a yarn.lock and caches efficiently.
uses: bahmutov/npm-install@v1

- name: ⤴️ Update Version if needed
- name: ⤴️ Update Version
id: version
shell: bash
run: |
# get latest commit sha
git config --local user.email "[email protected]"
git config --local user.name "Remix Run Bot"
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}
# set up for reuse
NIGHTLY_PREFIX=0.0.0-nightly
NIGHTLY_TAG_PREFIX=v${NIGHTLY_PREFIX}-
# get latest nightly tag
LATEST_NIGHTLY_TAG=$(git tag --sort=-taggerdate | grep ${NIGHTLY_TAG_PREFIX} | head -n 1)
git checkout -b nightly/${NEXT_VERSION}
# check if last commit to dev starts would be the nightly tag we're about to create (minus the date)
# if it is, we'll skip the nightly creation
# if not, we'll create a new nightly tag
if [[ $LATEST_NIGHTLY_TAG == ${NIGHTLY_TAG_PREFIX}${SHORT_SHA}-* ]]; then
echo "🛑 Latest nightly tag is the same as the latest commit sha, skipping nightly release"
if [ -z "$(git status --porcelain)" ]; then
echo "✨"
else
git config --local user.email "[email protected]"
git config --local user.name "Remix Run Bot"
DATE=$(date '+%Y%m%d')
NEXT_VERSION=${NIGHTLY_TAG_PREFIX}${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
echo "dirty working directory..."
git add .
git commit -m "dirty working directory..."
fi
yarn run version ${NEXT_VERSION} --skip-prompt
- name: 🏗 Build
if: steps.version.outputs.NEXT_VERSION
run: yarn build

- name: 🏷 Push Tag
if: steps.version.outputs.NEXT_VERSION
run: git push origin --tags

- name: 🔐 Setup npm auth
if: steps.version.outputs.NEXT_VERSION
run: |
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: 🚀 Publish
if: steps.version.outputs.NEXT_VERSION
run: npm run publish

- name: 🐱 Create GitHub release
uses: actions/create-release@v1
if: steps.version.outputs.NEXT_VERSION
with:
draft: false
prerelease: true
Expand All @@ -114,7 +92,7 @@ jobs:
comment:
needs: [nightly]
name: 🛴 Kick off comment and deployment test workflows
if: github.repository == 'remix-run/remix' && needs.nightly.outputs.NEXT_VERSION
if: github.repository == 'remix-run/remix'
runs-on: ubuntu-latest
steps:
- uses: peter-evans/repository-dispatch@v2
Expand Down

0 comments on commit 4b2114e

Please sign in to comment.