diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index d4a7233e802..0915b312c45 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -17,11 +17,6 @@ on: paths: - "src/docs/**" - "CHANGELOG.md" - workflow_run: - workflows: - - "๐ŸŽ‰ Release new version" - types: - - completed jobs: deploy-docs: diff --git a/.github/workflows/release-new-version.yml b/.github/workflows/release-new-version.yml index 2756afd0db2..aa7e9adafbd 100644 --- a/.github/workflows/release-new-version.yml +++ b/.github/workflows/release-new-version.yml @@ -26,9 +26,10 @@ on: - "!src/experiments/**" jobs: - release: - timeout-minutes: 10 + build: + name: ๐Ÿ”จ Build if: github.repository == 'saadeghi/daisyui' + timeout-minutes: 10 runs-on: ubuntu-latest env: runtime: ${{ github.event.inputs.runtime || 'bun'}} @@ -43,7 +44,7 @@ jobs: node-version: "latest" registry-url: https://registry.npmjs.org - - name: Setup bun + - name: Setup Bun if: env.runtime == 'bun' uses: oven-sh/setup-bun@v1 @@ -53,31 +54,30 @@ jobs: - name: build package run: ${{ env.runtime }} run build - - name: Release + - name: Run release command run: | git config --local user.email "pouya.saadeghi@gmail.com" git config --local user.name "Pouya Saadeghi" ${{ env.runtime }} run release${{ github.event.inputs.release-type }} - - name: get-npm-version + - name: Read package version from package.json id: package-version run: | - echo current-version=$(grep -o '"version": *"[^"]*"' package.json | cut -d'"' -f4) >> $GITHUB_OUTPUT + version=$(grep -o '"version": *"[^"]*"' package.json | cut -d'"' -f4) + echo version=$version >> $GITHUB_OUTPUT - - name: update package version in env - run: echo "VITE_DAISYUI_VERSION=${{ steps.package-version.outputs.current-version }}" > src/docs/.env - - - name: Commit files + - name: Update package version in src/docs/.env and commit id: commit run: | + echo "VITE_DAISYUI_VERSION=${{ steps.package-version.outputs.version }}" > src/docs/.env git config --local user.email "pouya.saadeghi@gmail.com" git config --local user.name "Pouya Saadeghi" git add --all if [-z "$(git status --porcelain)"]; then - echo "push=false" >> $GITHUB_OUTPUT + echo push=false >> $GITHUB_OUTPUT else - git commit -m "Update version: ${{ steps.package-version.outputs.current-version }}" -a - echo "push=true" >> $GITHUB_OUTPUT + git commit -m "Update src/docs/.env" -a + echo push=true >> $GITHUB_OUTPUT fi shell: bash @@ -87,14 +87,47 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} - - name: Setup Node.js + publish-npm: + name: ๐Ÿš€ Publish to NPM + if: github.repository == 'saadeghi/daisyui' + timeout-minutes: 5 + runs-on: ubuntu-latest + needs: build + env: + runtime: ${{ github.event.inputs.runtime || 'bun'}} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node if: env.runtime != 'npm' uses: actions/setup-node@v3 with: node-version: "latest" registry-url: https://registry.npmjs.org - - name: Publish package + - name: Publish package to NPM run: npm publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + + deploy-docs: + name: ๐Ÿ“˜ Docs + needs: publish-npm + uses: ./.github/workflows/deploy-docs.yml + secrets: inherit + + run-tests: + name: ๐Ÿงช Tests + needs: publish-npm + uses: ./.github/workflows/run-tests.yml + secrets: inherit + with: + filter: " " + + write-release-notes: + name: ๐Ÿ“ Release notes + if: github.repository == 'saadeghi/daisyui' + needs: run-tests + uses: ./.github/workflows/write-release-notes.yml + secrets: inherit diff --git a/.github/workflows/tests.yml b/.github/workflows/run-tests.yml similarity index 91% rename from .github/workflows/tests.yml rename to .github/workflows/run-tests.yml index 28b6962a9f6..13df2adcfde 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,6 +14,10 @@ on: - "-t foreground" - "-t variables" - "-t colors" + workflow_call: + inputs: + filter: + type: string push: branches: - master @@ -27,7 +31,7 @@ jobs: timeout-minutes: 10 env: filter: ${{ github.event.inputs.filter || ' '}} - name: "Build" + name: "Tests" runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/write-release-notes.yml b/.github/workflows/write-release-notes.yml new file mode 100644 index 00000000000..f284f85ff9a --- /dev/null +++ b/.github/workflows/write-release-notes.yml @@ -0,0 +1,39 @@ +name: "๐Ÿ“ write release notes" + +on: + workflow_call: + +jobs: + write-release-notes: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Read package version from package.json + id: package-version + run: | + version=$(grep -o '"version": *"[^"]*"' package.json | cut -d'"' -f4) + echo version=$version >> $GITHUB_OUTPUT + if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo $version is a stable version + echo is-stable=true >> $GITHUB_OUTPUT + else + echo $version is not a stable version + fi + + - name: Add release notes to GitHub + uses: softprops/action-gh-release@v1 + if: steps.package-version.outputs.is-stable == 'true' + with: + tag_name: v${{ steps.package-version.outputs.version }} + body: | + ๐ŸŒผ Read changelog: https://daisyui.com/docs/changelog/ + + ๐Ÿ“ฆ Install this update: + ```bash + npm i -D daisyui@${{ steps.package-version.outputs.version }} + ``` + + ๐Ÿ’š Thank you for using daisyUI!