-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 [merge] Merge pull request #57 from RSS1102/ci
🏗️ [ci] create publish ` release-nightly` ci
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 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,68 @@ | ||
name: Release Nightly | ||
|
||
on: | ||
schedule: | ||
- cron: "00 22 * * *" | ||
|
||
jobs: | ||
check: | ||
if: ${{ github.ref == 'refs/heads/main'}} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check for new commits | ||
id: check | ||
run: | | ||
DATE=$(date -u -d "1 day ago" "+%Y-%m-%d") | ||
if git log --since="$DATE" --oneline | grep .; then | ||
echo "new_commits=true" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "new_commits=false" >> "$GITHUB_OUTPUT" | ||
fi | ||
outputs: | ||
new_commits: ${{ steps.check.outputs.new_commits }} | ||
|
||
build: | ||
needs: check | ||
if: ${{ needs.check.outputs.new_commits == 'true'}} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Install dependencies | ||
run: npm install pnpm -g && pnpm install | ||
|
||
- name: Build package | ||
run: pnpm run build | ||
|
||
- name: Get current package version | ||
id: version | ||
run: | | ||
DATE=$(date "+%Y%m%d") | ||
echo "version=$(node -p "require('./lib/package.json').version")-nightly.$DATE">> "$GITHUB_ENV" | ||
- name: cd cli/build/config/output | ||
run: cd cli/build/config/output | ||
|
||
- name: Change package name | ||
run: jq '.name="shuimo-ui-nightly"' package.json > temp.json && mv temp.json package.json | ||
|
||
- name: change version | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Cai" | ||
npm version ${{ env.version }} --force | ||
- name: Publish package | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |