diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ebd6162e4ac..78d440b9aa5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -46,38 +46,28 @@ jobs: - name: 📥 Install deps run: yarn --frozen-lockfile - - name: ⤴️ Update Version if needed + - name: 🕵️ Check for changes id: version run: | # get latest commit sha SHA=$(git rev-parse HEAD) + # get first 7 characters of sha SHORT_SHA=${SHA::7} # get latest nightly tag LATEST_NIGHTLY_TAG=$(git tag -l v0.0.0-nightly-\* --sort=-committerdate | head -n 1) + # get changes since last nightly CHANGES=$(git diff $LATEST_NIGHTLY_TAG..dev -- ./packages/ -- ':!packages/**/package.json') # check if there are changes to ./packages if [[ -n $(echo $CHANGES | xargs) ]]; then - git config --local user.email "hello@remix.run" - git config --local user.name "Remix Run Bot" - + # yyyyMMdd format (e.g. 20221207) DATE=$(date '+%Y%m%d') + # v0.0.0-nightly-- NEXT_VERSION=0.0.0-nightly-${SHORT_SHA}-${DATE} + # set output so it can be used in other jobs echo "NEXT_VERSION=${NEXT_VERSION}" >> $GITHUB_OUTPUT - - 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 else echo "🛑 no changes since last nightly, skipping..." fi @@ -86,6 +76,14 @@ jobs: if: steps.version.outputs.NEXT_VERSION run: yarn build + - name: ⤴️ Update version + if: steps.version.outputs.NEXT_VERSION + run: | + git config --local user.email "hello@remix.run" + git config --local user.name "Remix Run Bot" + git checkout -b nightly/${steps.version.outputs.NEXT_VERSION} + yarn run version ${steps.version.outputs.NEXT_VERSION} --skip-prompt + - name: 🏷 Push Tag if: steps.version.outputs.NEXT_VERSION run: git push origin --tags