diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000..c4f0263e --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,128 @@ +name: Publish documentation + +on: + pull_request: + types: [closed] + branches: ["main", "next"] + +permissions: + contents: write + id-token: write + pages: write + +concurrency: + group: pages-${{ github.workflow }}-${{ 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 }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Get version + id: version + run: echo "version=$(jq -r '.version' amicons/package.json)" >> $GITHUB_OUTPUT + - 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: amicons/pnpm-lock.yaml + - name: Install dependencies + working-directory: amicons + run: pnpm install --frozen-lockfile + - name: Production build + working-directory: amicons + run: pnpm prod + - name: Pack for npm + working-directory: amicons + run: pnpm pack + - name: Package icons + working-directory: amicons/icons + run: zip -r ../../amicons-${{ steps.version.outputs.version }}-icons.zip . -i "*.svg" + - name: Upload artifacts + uses: actions/upload-artifact@v7 + with: + name: release-artifacts + path: | + amicons/dist + 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, 'docs') && 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 + + 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 + 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd90c9d9..06ff99c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release +name: Release Amicons update on: pull_request: @@ -60,7 +60,7 @@ jobs: docs_check: name: Docs linting and formatting - if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.repo.full_name == github.repository && (contains(github.event.pull_request.labels.*.name, 'release') || contains(github.event.pull_request.labels.*.name, 'docs')) + 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: @@ -88,7 +88,7 @@ jobs: release: name: Release Amicons stable needs: [build, docs_check] - if: github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'release') + 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 runs-on: ubuntu-latest steps: - name: Download artifacts @@ -119,8 +119,8 @@ jobs: deploy-docs: name: Deploy to GitHub Pages - needs: [docs_check, release] - if: always() && github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.repo.full_name == github.repository && ((contains(github.event.pull_request.labels.*.name, 'release') && needs.docs_check.result == 'success' && needs.release.result == 'success') || (!contains(github.event.pull_request.labels.*.name, 'release') && contains(github.event.pull_request.labels.*.name, 'docs') && needs.docs_check.result == 'success')) + 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 }} @@ -131,6 +131,10 @@ jobs: 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: