name: Main on: push: branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true defaults: run: shell: bash -l {0} env: BUILD_CACHE_NAME: build-cache permissions: {} jobs: Create-Build-Cache: runs-on: ubuntu-latest steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version-file: ".nvmrc" cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Upload dist-storybook to Cache uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 id: storybook-dist-cache with: path: | libs/backpack-storybook-host/dist-storybook/ .nx/cache/ key: ${{ env.BUILD_CACHE_NAME }}-${{ hashFiles('packages/backpack-web/**', 'libs/backpack-storybook-utils/**', 'libs/backpack-storybook-host/**') }} - name: Create build cache if: ${{ steps.storybook-dist-cache.outputs.cache-hit != 'true' }} run: | pnpm run build pnpm run storybook:dist Build: permissions: actions: read contents: read statuses: write pull-requests: write needs: [Create-Build-Cache] uses: ./.github/workflows/_build.yml secrets: GH_APP_PRIVATE_KEY: ${{ secrets.GH_APP_PRIVATE_KEY }} PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} StorybookDeploy: runs-on: ubuntu-latest needs: [Create-Build-Cache] steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version-file: ".nvmrc" cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Restore Cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 id: storybook-dist-cache with: path: | libs/backpack-storybook-host/dist-storybook/ .nx/cache/ key: ${{ env.BUILD_CACHE_NAME }}-${{ hashFiles('packages/backpack-web/**', 'libs/backpack-storybook-utils/**', 'libs/backpack-storybook-host/**') }} - name: Deploy Storybook for main uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0 if: github.ref == 'refs/heads/main' with: personal_token: ${{ secrets.DEPLOY_TOKEN }} publish_dir: libs/backpack-storybook-host/dist-storybook/ keep_files: false external_repository: backpack/storybook publish_branch: main SassDocDeploy: runs-on: ubuntu-latest needs: [Create-Build-Cache] steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version-file: ".nvmrc" cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build Sass docs if: github.ref == 'refs/heads/main' run: pnpm run sassdoc - name: Deploy Sass docs to backpack.github.io, if on main branch uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0 if: github.ref == 'refs/heads/main' with: personal_token: ${{ secrets.DEPLOY_TOKEN }} publish_dir: dist-sassdoc/ keep_files: false external_repository: backpack/sassdoc publish_branch: main ReleaseDraft: runs-on: ubuntu-latest permissions: contents: write pull-requests: read steps: - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 id: app-token with: app-id: ${{ vars.GH_APP_ID }} private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} - name: Draft release notes uses: release-drafter/release-drafter@4d75298e00d9e34c483e5ff8c68d0ea1c1940c1e # v7.5.1 # release-drafter v7 no longer reads the GITHUB_TOKEN env var; the # token must be passed via the `token` input or it falls back to the # default `github.token`, which lacks the GitHub App permissions we # rely on for drafting releases. with: token: ${{ steps.app-token.outputs.token }}