-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d92384f
commit ec86f90
Showing
7 changed files
with
182 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Create a tag | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
# Cancels all previous workflow runs for pull requests that have not completed. | ||
concurrency: | ||
# The concurrency group contains the workflow name and the branch name for pull requests | ||
# or the commit hash for any other events. | ||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
coverage: none | ||
tools: composer, cs2pr | ||
|
||
- name: Use desired version of NodeJS | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.15 | ||
cache: 'npm' | ||
|
||
- name: Composer Install | ||
uses: ramsey/composer-install@v3 | ||
|
||
- name: Build the release | ||
run: npm install && npm run release | ||
|
||
- name: Maybe create a tag | ||
run: bash bin/release.sh | ||
|
||
- name: Release | ||
if: ${{ env.TAG_CREATED == 'true' }} | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ env.BRAINSTORM_FORCE_RELEASE }} | ||
body: '' | ||
name: v${{ env.BRAINSTORM_FORCE_RELEASE }} | ||
draft: false | ||
files: force-ui.zip | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules | |
dist/* | ||
.DS_Store | ||
*storybook.log | ||
storybook-static/* | ||
storybook-static/* | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
echo "💃 Time to build the force-ui plugin ZIP file 🕺" | ||
|
||
echo "Creating archive... 🎁" | ||
|
||
zip -r force-ui.zip \ | ||
dist \ | ||
version.json \ | ||
changelog.txt | ||
|
||
echo "Done. You've built force-ui! 🎉 " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#!/bin/bash -e | ||
# | ||
# Deploy your branch. | ||
# | ||
|
||
DEPLOY_SUFFIX="${DEPLOY_SUFFIX:--built}" | ||
GIT_USER="${DEPLOY_GIT_USER:-GitHub Actions}" | ||
GIT_EMAIL="${DEPLOY_GIT_EMAIL:-hello@bsf.io}" | ||
|
||
BRANCH="${GITHUB_REF:-master}" | ||
SRC_DIR="$PWD" | ||
BUILD_DIR="/tmp/brainstormforce-build" | ||
|
||
if [[ -d "$BUILD_DIR" ]]; then | ||
echo "WARNING: ${BUILD_DIR} already exists. You may have accidentally cached this" | ||
echo "directory. This will cause issues with deploying." | ||
exit 1 | ||
fi | ||
|
||
COMMIT=$(git rev-parse HEAD) | ||
VERSION=$(grep 'Version: ' $PWD/ai-builder.php | grep -oEi '[0-9\.a-z\+-]+$') | ||
|
||
# Check if the tag exists in the remote GitHub repository. | ||
TAG_EXISTS=$(git ls-remote --tags origin | grep -c "refs/tags/$VERSION") | ||
|
||
# If tag is already found, exit by setting env variables. | ||
# exit 0 to exit with a success. | ||
if [ $TAG_EXISTS != 0 ]; then | ||
echo "BRAINSTORM_FORCE_RELEASE=$VERSION" >>$GITHUB_ENV | ||
echo "TAG_CREATED=false" >>$GITHUB_ENV | ||
exit 0 | ||
fi | ||
|
||
if [[ $VERSION != "null" ]]; then | ||
DEPLOY_BRANCH="release/${VERSION}" | ||
DEPLOY_AS_RELEASE="${DEPLOY_AS_RELEASE:-yes}" | ||
else | ||
DEPLOY_BRANCH="${BRANCH}${DEPLOY_SUFFIX}" | ||
DEPLOY_AS_RELEASE="${DEPLOY_AS_RELEASE:-no}" | ||
fi | ||
|
||
echo "Deploying $BRANCH to $DEPLOY_BRANCH" | ||
|
||
# If the deploy branch doesn't already exist, create it from the empty root. | ||
if ! git rev-parse --verify "remotes/origin/$DEPLOY_BRANCH" >/dev/null 2>&1; then | ||
echo -e "\nCreating $DEPLOY_BRANCH..." | ||
git worktree add --detach "$BUILD_DIR" | ||
cd "$BUILD_DIR" | ||
git checkout --orphan "$DEPLOY_BRANCH" | ||
else | ||
echo "Using existing $DEPLOY_BRANCH" | ||
git worktree add --detach "$BUILD_DIR" "remotes/origin/$DEPLOY_BRANCH" | ||
cd "$BUILD_DIR" | ||
git checkout "$DEPLOY_BRANCH" | ||
fi | ||
|
||
# Ensure we're in the right dir | ||
cd "$BUILD_DIR" | ||
|
||
# Remove existing files | ||
git rm -rfq . | ||
|
||
# Sync built files | ||
echo -e "\nSyncing files..." | ||
|
||
rsync -av "$SRC_DIR/" "$BUILD_DIR" --exclude-from "$SRC_DIR/.distignore" | ||
|
||
# Add changed files | ||
git add . | ||
|
||
if [ -z "$(git status --porcelain)" ]; then | ||
echo "No changes to built files." | ||
exit | ||
fi | ||
|
||
# Print status! | ||
echo -e "\nSynced files. Changed:" | ||
git status -s | ||
|
||
# Double-check our user/email config | ||
if ! git config user.email; then | ||
git config user.name "$GIT_USER" | ||
git config user.email "$GIT_EMAIL" | ||
fi | ||
|
||
# Commit it. | ||
MESSAGE=$(printf 'Build changes from %s\n\n%s' "${COMMIT}" "${CIRCLE_BUILD_URL}") | ||
git commit -m "$MESSAGE" | ||
|
||
# Push it (real good). | ||
git push origin "$DEPLOY_BRANCH" | ||
|
||
# Make a release if one doesn't exist. | ||
if [[ $DEPLOY_AS_RELEASE = "yes" && $(git tag -l "$VERSION") != $VERSION ]]; then | ||
git tag "$VERSION" | ||
git push origin "$VERSION" | ||
echo "BRAINSTORM_FORCE_RELEASE=$VERSION" >>$GITHUB_ENV | ||
echo "TAG_CREATED=true" >>$GITHUB_ENV | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Version 0.0.3 - 2nd October, 2024 | ||
- New - Breadcrumb | ||
- New - Grid Container | ||
- New - Dialog Component | ||
- New - Drawer Component | ||
- New - Menu & Menu Item Component | ||
- New - Sidebar | ||
- New - Topbar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"force-ui": "0.0.3" | ||
} |