diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index c4f0263e..b10ee406 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,9 +1,8 @@ name: Publish documentation on: - pull_request: - types: [closed] - branches: ["main", "next"] + push: + branches: ["main"] permissions: contents: write @@ -11,13 +10,12 @@ permissions: pages: write concurrency: - group: pages-${{ github.workflow }}-${{ github.ref }} + group: documentation-${{ github.ref }} cancel-in-progress: true jobs: build: name: Build Amicons package - if: github.event.pull_request.merged == true && github.event.pull_request.head.repo.full_name == github.repository && (github.event.pull_request.base.ref == 'next' || (github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.labels.*.name, 'docs'))) runs-on: ubuntu-latest outputs: version: ${{ steps.version.outputs.version }} @@ -60,7 +58,6 @@ jobs: docs_check: name: Docs linting and formatting - if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.labels.*.name, 'docs') && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest defaults: run: @@ -87,8 +84,7 @@ jobs: deploy-docs: name: Deploy to GitHub Pages - needs: [docs_check] - if: github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.labels.*.name, 'docs') && github.event.pull_request.head.repo.full_name == github.repository + needs: [build, docs_check] environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 06ff99c7..8c1656db 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ permissions: pages: write concurrency: - group: pages-${{ github.workflow }}-${{ github.ref }} + group: release-${{ github.ref }} cancel-in-progress: true jobs: @@ -58,37 +58,10 @@ jobs: amicons/studio384-amicons-*.tgz amicons-${{ steps.version.outputs.version }}-icons.zip - docs_check: - name: Docs linting and formatting - if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.labels.*.name, 'release') && github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-latest - defaults: - run: - working-directory: docs - steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Set up pnpm - uses: pnpm/action-setup@v5 - with: - version: 10.33.0 - - name: Set up Node 24 - uses: actions/setup-node@v6 - with: - node-version: 24.x - cache: "pnpm" - cache-dependency-path: docs/pnpm-lock.yaml - - name: Install dependencies - run: pnpm install --frozen-lockfile --ignore-scripts - - name: Check formatting - run: pnpm format - - name: Lint - run: pnpm lint - release: name: Release Amicons stable - needs: [build, docs_check] - if: github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.labels.*.name, 'release') && github.event.pull_request.head.repo.full_name == github.repository + needs: build + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.labels.*.name, 'release') && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - name: Download artifacts @@ -100,69 +73,23 @@ jobs: with: node-version: 24.x registry-url: "https://registry.npmjs.org" - - name: Write release notes - env: - BODY: ${{ github.event.pull_request.body }} - run: printf '%s' "$BODY" > release-notes.md - name: Create GitHub release run: | gh release create v${{ needs.build.outputs.version }} \ --repo ${{ github.repository }} \ --target "${{ github.event.pull_request.merge_commit_sha }}" \ --title "${{ github.event.pull_request.title }}" \ - --notes-file release-notes.md \ + --notes "${{ github.event.pull_request.body }}" \ "amicons-${{ needs.build.outputs.version }}-icons.zip#Amicons icons v${{ needs.build.outputs.version }}" env: GH_TOKEN: ${{ github.token }} - name: Publish to npm run: npm publish ./amicons/studio384-amicons-${{ needs.build.outputs.version }}.tgz --access public --provenance --tag latest - deploy-docs: - name: Deploy to GitHub Pages - needs: [release, docs_check] - if: github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.labels.*.name, 'release') && github.event.pull_request.head.repo.full_name == github.repository - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - defaults: - run: - working-directory: docs - steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Download artifacts - uses: actions/download-artifact@v8 - with: - name: release-artifacts - - name: Set up pnpm - uses: pnpm/action-setup@v5 - with: - version: 10.33.0 - - name: Set up Node 24 - uses: actions/setup-node@v6 - with: - node-version: 24.x - cache: "pnpm" - cache-dependency-path: docs/pnpm-lock.yaml - - name: Install dependencies - run: pnpm install --frozen-lockfile - - name: Build - run: pnpm build - - name: Setup Pages - uses: actions/configure-pages@v5 - - name: Upload artifact - uses: actions/upload-pages-artifact@v4 - with: - path: docs/dist - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 - prerelease: name: Prerelease Amicons preview needs: build - if: github.event.pull_request.base.ref == 'next' && github.event.pull_request.head.repo.full_name == github.repository + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'next' && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - name: Download artifacts @@ -174,18 +101,14 @@ jobs: with: node-version: 24.x registry-url: "https://registry.npmjs.org" - - name: Write release notes - env: - BODY: ${{ github.event.pull_request.body }} - run: printf '%s' "$BODY" > release-notes.md - name: Create GitHub prerelease run: | gh release create v${{ needs.build.outputs.version }} \ --repo ${{ github.repository }} \ --target "${{ github.event.pull_request.merge_commit_sha }}" \ --title "${{ github.event.pull_request.title }}" \ + --notes "${{ github.event.pull_request.body }}" \ --prerelease \ - --notes-file release-notes.md \ "amicons-${{ needs.build.outputs.version }}-icons.zip#Amicons icons v${{ needs.build.outputs.version }}" env: GH_TOKEN: ${{ github.token }}