Release Nightly #266
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
name: Release Nightly | |
on: | |
schedule: | |
- cron: "00 22 * * *" | |
jobs: | |
check: | |
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'shuimo-design/shuimo-ui'}} | |
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: Change package name | |
run: | | |
cd cli/build/config/output/ | |
jq '.name="shuimo-ui-nightly"' package.json > temp.json && mv temp.json package.json | |
- name: change version | |
run: | | |
cd cli/build/config/output/ | |
npm version ${{ env.version }} | |
- name: Publish package | |
run: | |
cd cli/build/config/output/ && npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |