Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(nightly): move git operations after build #4797

Merged
merged 2 commits into from
Dec 7, 2022
Merged
Changes from 1 commit
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
Next Next commit
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>
  • Loading branch information
mcansh committed Dec 7, 2022
commit 36b661387639d12ffc705668158e5e199b4a5bb3
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/${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