-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from DIG-Network/release/v1.1.1-alpha.0
Release/v1.1.1 alpha.0
- Loading branch information
Showing
6 changed files
with
188 additions
and
4 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,48 @@ | ||
name: Auto Tag | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: main-release-check | ||
|
||
jobs: | ||
release: | ||
name: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clean workspace | ||
uses: Chia-Network/actions/clean-workspace@main | ||
|
||
- name: Checkout current branch | ||
uses: actions/checkout@v3 | ||
with: | ||
# Need PACKAGE_ADMIN_PAT token so when the tag is created, the tag automation runs | ||
token: ${{ secrets.GH_ACCESS_TOKEN }} | ||
fetch-depth: 0 | ||
|
||
- name: Set Git identity | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Automation" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract version from package.json | ||
run: | | ||
VERSION=$(jq -r '.version' package.json) | ||
echo "Extracted version: $VERSION" | ||
# Set the version as an output for other steps to use | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
if git tag --list | grep -q "^$VERSION$"; then | ||
echo "Tag $VERSION already exists, nothing to do." | ||
else | ||
echo "Tag does not exist. Creating and pushing tag." | ||
git tag $VERSION -m "Release $VERSION" | ||
git push origin $VERSION | ||
fi | ||
shell: bash |
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,52 @@ | ||
name: Build and Publish to npm | ||
|
||
on: | ||
push: | ||
tags: | ||
- "**" | ||
|
||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-and-publish: | ||
name: Build and Publish to npm | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18.x" | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Build Project | ||
run: npm run build | ||
|
||
- name: Extract Version and Determine Tag | ||
id: extract-version | ||
run: | | ||
VERSION=$(jq -r '.version' package.json) | ||
if [[ "$VERSION" == *"alpha"* ]]; then | ||
TAG="alpha" | ||
elif [[ "$VERSION" == *"beta"* ]]; then | ||
TAG="beta" | ||
else | ||
TAG="latest" | ||
fi | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "TAG=$TAG" >> $GITHUB_ENV | ||
- name: Publish to npm | ||
run: | | ||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | ||
npm publish --tag ${{ env.TAG }} --access public | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# This workflow runs on any PRs that are targeting main and ensures that the version in package.json is incremented | ||
name: Check Version Increment | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
concurrency: | ||
# SHA is added to the end if on `main` to let all main workflows run | ||
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-version: | ||
name: Check version increment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: Chia-Network/actions/clean-workspace@main | ||
|
||
- name: Checkout current branch | ||
uses: actions/checkout@v3 | ||
with: | ||
path: branch-repo | ||
|
||
- name: Checkout main | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
path: main-repo | ||
|
||
- name: Check Versions | ||
run: | | ||
# Extract version from main branch's package.json | ||
mainVersion=$(jq -r '.version' main-repo/package.json) | ||
echo "Main version: $mainVersion" | ||
# Extract version from current branch's package.json | ||
branchVersion=$(jq -r '.version' branch-repo/package.json) | ||
echo "Branch version: $branchVersion" | ||
# Compare versions | ||
if [ "$branchVersion" == "$mainVersion" ]; then | ||
echo "Version in package.json on this branch is not incremented. Version must increment for a merge to main." | ||
exit 1 | ||
fi | ||
shell: bash |
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
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,36 @@ | ||
#!/bin/bash | ||
|
||
# Check for uncommitted changes | ||
if ! git diff-index --quiet HEAD --; then | ||
echo "You have uncommitted changes. Please commit or stash them before running this script." | ||
exit 1 | ||
fi | ||
|
||
# Ensure we're on the develop branch | ||
CURRENT_BRANCH=$(git branch --show-current) | ||
if [ "$CURRENT_BRANCH" != "develop" ]; then | ||
echo "You must be on the 'develop' branch to run this script." | ||
exit 1 | ||
fi | ||
|
||
# Run standard-version for version bumping | ||
npx standard-version --prerelease alpha | ||
|
||
# Extract the new version from package.json after bumping | ||
NEW_VERSION=$(jq -r '.version' package.json) | ||
|
||
# Create a new feature branch based on the new version | ||
FEATURE_BRANCH="release/v$NEW_VERSION" | ||
git checkout -b "$FEATURE_BRANCH" | ||
|
||
# Commit changes | ||
git add . | ||
git commit -m "chore(release): bump version to $NEW_VERSION" | ||
git push --set-upstream origin "$FEATURE_BRANCH" | ||
|
||
# Notify the user about the feature branch | ||
echo "Version bumped and committed on branch $FEATURE_BRANCH." | ||
|
||
git checkout develop | ||
|
||
echo "Release PR set to origin on branch $FEATURE_BRANCH." |