From a00f1e82e11ff0b2a8c4b5fc868a5517825003fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joost=20Z=C3=B6llner?= Date: Fri, 30 Aug 2024 11:58:10 +0200 Subject: [PATCH] feat: #29 add github action to deploy storybook to github pages (#30) --- .github/workflows/ci.yml | 66 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 42 ---------------------- 2 files changed, 66 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f1572e..989faf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,3 +26,69 @@ jobs: run: npm run lint - name: Build Package run: npm run build + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build_artifacts + path: | + packages/**/dist/** + **/package.json + **/README.md + **/CHANGELOG.md + !**/node_modules/** + + deploy-pages: + permissions: + contents: read + pages: write + id-token: write + runs-on: macos-latest + if: ${{ github.ref == 'refs/heads/main' }} + needs: build + steps: + - name: Download previous build artifacts + uses: actions/download-artifact@v4 + with: + name: build_artifacts + - name: Upload pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: packages/documentation/dist/ + - name: Deploy to GitHub Pages + uses: actions/deploy-pages@v4 + + release: + permissions: + id-token: write # to publish with provenance + contents: write # to create release (changesets/action) + issues: write # to post issue comments (changesets/action) + pull-requests: write # to create pull request (changesets/action) + runs-on: macos-latest + if: ${{ github.ref == 'refs/heads/main' }} + concurrency: ${{ github.workflow }}-${{ github.ref }} + needs: build + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: ".node-version" + cache: "npm" + - name: Install Dependencies + run: npm ci + - name: Download previous build artifacts + uses: actions/download-artifact@v4 + with: + name: build_artifacts + - name: Version and/or Publish Package + uses: changesets/action@v1 + with: + publish: npm run release + version: npm run version + commit: "ci: release package" + title: "ci: release package" + env: + NPM_CONFIG_PROVENANCE: true + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 87196ea..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: release - -on: - push: - branches: - - main - -concurrency: ${{ github.workflow }}-${{ github.ref }} - -permissions: - id-token: write # to publish with provenance - contents: write # to create release (changesets/action) - issues: write # to post issue comments (changesets/action) - pull-requests: write # to create pull request (changesets/action) - -jobs: - release: - if: github.repository == 'holisticon/atomic-playfulness' - runs-on: macos-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version-file: ".node-version" - cache: "npm" - - name: Install Dependencies - run: npm ci - - name: Build Package - run: npm run build - - name: Version and/or Publish Package - uses: changesets/action@v1 - with: - publish: npm run release - version: npm run version - commit: "ci: release package" - title: "ci: release package" - env: - NPM_CONFIG_PROVENANCE: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }}