Skip to content

Commit

Permalink
ci(nightly): move git operations after build (#4797)
Browse files Browse the repository at this point in the history
* ci(nightly): move git operations after build

when adding deno typechecking (#4715), nightly now refers to the version we just calculated which hasnt been published when trying to build and typecheck

Signed-off-by: Logan McAnsh <logan@mcan.sh>

* ci: update tmp branch name

Signed-off-by: Logan McAnsh <logan@mcan.sh>

Signed-off-by: Logan McAnsh <logan@mcan.sh>
  • Loading branch information
mcansh committed Dec 7, 2022
1 parent 7e54f4d commit c9413eb
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-<short sha>-<date>
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
Expand All @@ -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
Expand Down

0 comments on commit c9413eb

Please sign in to comment.