change package name #1
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: "Build, Publish, Deploy" | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
release: | |
name: "Build" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 16.8.0 | |
registry-url: https://registry.npmjs.org | |
- name: check latest released version | |
id: check | |
uses: EndBug/[email protected] | |
with: | |
file-url: https://unpkg.com/daisyui@latest/package.json | |
static-checking: localIsNew | |
- name: Install dependencies | |
if: steps.check.outputs.changed == 'true' | |
run: npm install | |
- name: build | |
if: steps.check.outputs.changed == 'true' | |
run: npm run build | |
- name: Publish | |
if: steps.check.outputs.changed == 'true' | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
- name: Read package version from package.json | |
if: steps.check.outputs.changed == 'true' | |
uses: nyaa8/package-version@v1 | |
with: | |
path: "package.json" | |
- name: update package version in env | |
if: steps.check.outputs.changed == 'true' | |
uses: SpicyPizza/create-envfile@v1 | |
with: | |
envkey_VITE_DAISYUI_VERSION: ${{ env.PACKAGE_VERSION }} | |
file_name: src/docs/.env | |
- name: update package version in readme | |
if: steps.check.outputs.changed == 'true' | |
uses: mingjun97/file-regex-replace@v1 | |
with: | |
regex: 'cdn.jsdelivr.net\/npm\/daisyui@.*\/dist\/' | |
replacement: "cdn.jsdelivr.net/npm/daisyui@${{ env.PACKAGE_VERSION }}/dist/" | |
include: "README.md" | |
- name: Commit files | |
if: steps.check.outputs.changed == 'true' | |
id: commit | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "Pouya Saadeghi" | |
git add --all | |
if [-z "$(git status --porcelain)"]; then | |
echo "::set-output name=push::false" | |
else | |
git commit -m "Update version" -a | |
echo "::set-output name=push::true" | |
fi | |
shell: bash | |
- name: Push changes | |
if: steps.commit.outputs.push == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Wait 10 seconds for npm publish | |
if: steps.check.outputs.changed == 'true' | |
uses: whatnick/wait-action@master | |
with: | |
time: "10s" | |
- name: Install document website dependencies | |
run: cd src/docs && npm install | |
- name: Build document website | |
run: cd src/docs && npm run build | |
- name: Deploy docs to github pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./src/docs/build | |
cname: ${{ secrets.CNAME }} | |