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

Store epic-stack latest commit hash in the package.json #805

Merged
merged 11 commits into from
Aug 3, 2024

Conversation

jacobparis
Copy link
Contributor

@jacobparis jacobparis commented Jul 25, 2024

This PR adds a new Github Actions workflow that writes the current HEAD commit and the date to the package.json as a version tracking scheme. Epic Stack apps can use this to see when they detached from the original epic stack when trying to follow along with changes.

Anyone who clones the repo or uses npx create remix --template or npx create epic-app will have that hash automatically,

During this setup step, the version action is removed so it won't affect consumers of the stack in an ongoing basis.

Future automated tooling 👀 👀 👀 could use this to apply a series of commits automatically

This only applies during pushes to main/dev, all the extra commits in this PR come from that I was pushing to main directly to test it.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is cool and I'm happy to merge. Thank you for working on it!

.github/workflows/version.yml Outdated Show resolved Hide resolved
@kentcdodds kentcdodds merged commit a88ea9e into epicweb-dev:main Aug 3, 2024
@Merott
Copy link

Merott commented Aug 14, 2024

Thanks @jacobparis.

I'm now using this process to pull the latest changes from epic-stack into my own project:

# Clone the repo into a temporary directory and set up a branch for the update
TEMP_DIR=$(mktemp -d)
git clone --single-branch --branch main --depth 1 $(git remote get-url origin) "$TEMP_DIR/epic-stack-update"
cd "$TEMP_DIR/epic-stack-update"
git checkout -b epic-stack-update

# Add epic-stack as a remote and fetch the latest commits fom main branch
git remote add epic-stack [email protected]:epicweb-dev/epic-stack.git
git fetch epic-stack main

# Extract the last synced commit hash from package.json
LAST_SYNC_COMMIT=$(grep -o '"head": "[^"]*' package.json | sed 's/"head": "//')

# Cherry-pick new commits from Epic Stack
git cherry-pick -x --empty=drop ${LAST_SYNC_COMMIT}..epic-stack/main

# --------- Resolve conflicts (if needed) ---------
# NOTE: Epic Stack-specific files (including the `docs` directory) are not
# included in this repository and are safe to delete in case of conflicts.

# 1. Resolve conflicts in affected files
# 2. Stage resolved files: git add <resolved-file>
# 3. Continue: git cherry-pick --continue
# 4. To abort: git cherry-pick --abort
# -------------------------------------------------

# Switch back to main branch
git checkout main

# Merge epic-stack-update (no fast-forward)
git merge epic-stack-update --no-ff -m "chore: merge latest from epic-stack"

# Push merged changes
git push origin main

# Clean up: return to the original directory and remove the temporary one
cd -
rm -rf "$TEMP_DIR"

# Switch to the main branch and pull changes
git checkout main
git pull origin main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants