-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Add CI action to sync published versions simple example to sandbox repository #10273
Changes from 3 commits
4156ac9
88bdd9a
06133ae
c4edde2
c955a37
58dd150
5721590
742fcf9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,6 +5,8 @@ on: | |||||
branches: | ||||||
- master | ||||||
- next | ||||||
tags: | ||||||
- '*' | ||||||
pull_request: | ||||||
|
||||||
jobs: | ||||||
|
@@ -57,6 +59,7 @@ jobs: | |||||
|
||||||
doc-check: | ||||||
runs-on: ubuntu-latest | ||||||
if: github.ref_type != 'tag' | ||||||
steps: | ||||||
- name: Checkout | ||||||
uses: actions/checkout@v4 | ||||||
|
@@ -99,6 +102,7 @@ jobs: | |||||
|
||||||
e-commerce: | ||||||
runs-on: ubuntu-latest | ||||||
if: github.ref_type != 'tag' | ||||||
needs: [typecheck] | ||||||
steps: | ||||||
- name: Checkout | ||||||
|
@@ -133,6 +137,7 @@ jobs: | |||||
|
||||||
crm: | ||||||
runs-on: ubuntu-latest | ||||||
if: github.ref_type != 'tag' | ||||||
needs: [typecheck] | ||||||
steps: | ||||||
- name: Checkout | ||||||
|
@@ -157,7 +162,7 @@ jobs: | |||||
runs-on: ubuntu-latest | ||||||
name: GreenFrame | ||||||
needs: [e-commerce] | ||||||
if: success() && github.ref == 'refs/heads/master' | ||||||
if: success() && github.ref == 'refs/heads/master' && github.ref_type != 'tag' | ||||||
steps: | ||||||
# To use this repository's private action, | ||||||
# you must check out the repository | ||||||
|
@@ -208,3 +213,21 @@ jobs: | |||||
- name: Run the tests | ||||||
working-directory: ./myadmin | ||||||
run: npm run test | ||||||
|
||||||
update-sandbox-repository: | ||||||
runs-on: ubuntu-latest | ||||||
# Only run on new tags that target a release (not latest nor next) and avoid alpha and beta tags | ||||||
if: github.event_name == 'push' && github.ref_type == 'tag' && github.ref_name == 'refs/tags/v*' && !contains('beta', github.ref_name) && !contains('alpha', github.ref_name) | ||||||
needs: [typecheck, simple-example-typecheck, unit-test, e2e-test] | ||||||
steps: | ||||||
- name: Checkout | ||||||
uses: actions/checkout@v3 | ||||||
- name: Use Node.js LTS | ||||||
uses: actions/setup-node@v3 | ||||||
with: | ||||||
node-version: '16.x' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
To be consistent with other jobs of the workflow |
||||||
- name: Update Sandbox Repository | ||||||
env: | ||||||
SSH_DEPLOY_KEY: ${{ secrets.SSH_SANDBOX_DEPLOY_KEY }} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
To be consistent with the actual script |
||||||
SANDBOX_REPOSITORY: ${{ secrets.SANDBOX_REPOSITORY }} | ||||||
run: make update-sandbox | ||||||
slax57 marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -172,3 +172,6 @@ storybook: ## Launch the storybook | |||||
build-storybook: ## Build the storybook | ||||||
@echo "Building storybook..." | ||||||
@yarn build-storybook | ||||||
|
||||||
update-sandbox: ## Push the local version of the simple example to the sandbox repository | ||||||
./update-demo.sh | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(there is no |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# Configure git | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "React-Admin CI" | ||
|
||
# Configure ssh keys | ||
mkdir --parents "$HOME/.ssh" | ||
DEPLOY_KEY_FILE="$HOME/.ssh/deploy_key" | ||
echo "${SSH_SANDBOX_DEPLOY_KEY}" > "$DEPLOY_KEY_FILE" | ||
chmod 600 "$DEPLOY_KEY_FILE" | ||
SSH_KNOWN_HOSTS_FILE="$HOME/.ssh/known_hosts" | ||
ssh-keyscan -H github.com > "$SSH_KNOWN_HOSTS_FILE" | ||
|
||
# Override the default git ssh command so that it includes our ssh key | ||
export GIT_SSH_COMMAND="ssh -i "$DEPLOY_KEY_FILE" -o UserKnownHostsFile=$SSH_KNOWN_HOSTS_FILE" | ||
|
||
# Clone the demo repository inside a temporary directory | ||
TEMPD=$(mktemp -d) | ||
echo $TEMPD | ||
(git clone ${SANDBOX_REPOSITORY} $TEMPD) | ||
|
||
# Clean it up to ensure we don't keep deleted files | ||
(rm -rf $TEMPD/src) | ||
(rm -rf $TEMPD/assets) | ||
|
||
# Copy the demo files into the temporary directory | ||
(cp -r ./examples/simple/. $TEMPD) | ||
|
||
# Update the demo repository | ||
# Allow empty commits because even though we may have published new version of the enterprise packages, | ||
# the demo code may not have changed. However we still want it to be redeployed and, as we don't keep its | ||
# yarn.lock, it should use the new packages | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand the rationale, but I believe @fzaninotto was in favor of actually computing and committing the |
||
(cd $TEMPD && git add -A && git commit --allow-empty -m "Update sandbox" && git push) | ||
erwanMarmelab marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: on the contrary, we could run the Greenframe analysis only when a new tag/version is released, as opposed to any commit on
master
which might be a little too often. Wdyt?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fzaninotto any opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we should only test greenframe when releasing a new version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done