ci: 👷 Config release-please workflow #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Please | |
| on: | |
| push: | |
| branches: | |
| - fre/release-please | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| releases_created: ${{ steps.release.outputs.releases_created }} | |
| release_data: ${{ steps.release.outputs.releases_created && steps.release.outputs }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| config-file: .github/release-please-config.json | |
| manifest-file: .github/.release-please-manifest.json | |
| setup: | |
| if: ${{ needs.release-please.outputs.releases_created }} | |
| needs: release-please | |
| uses: ./.github/workflows/_setup.yml | |
| secrets: inherit | |
| with: | |
| cacheKey: ${{ github.sha }} | |
| checkout_paths: packages | |
| tag: latest # Automatisk publisering bruker 'latest' tag | |
| packages: | |
| if: ${{ needs.release-please.outputs.releases_created }} | |
| name: Process packages | |
| runs-on: ubuntu-latest | |
| needs: [setup, release-please] | |
| steps: | |
| - name: Use "setup" cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ./* | |
| ~/.pnpm-store | |
| key: ${{ github.sha }} | |
| - name: Use "dist" cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ./* | |
| ~/.pnpm-store | |
| key: ${{ github.sha }}-dist-production-core-react | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.12.0' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Build packages | |
| run: pnpm run build | |
| - name: Build Storybook | |
| run: pnpm build:storybook | |
| - name: log-errors-to-slack | |
| uses: act10ns/slack@v2 | |
| with: | |
| status: ${{ job.status }} | |
| steps: ${{ toJson(steps) }} | |
| if: failure() | |
| publish-base-packages: | |
| if: ${{ needs.release-please.outputs.releases_created }} | |
| name: Publish base packages to npm | |
| runs-on: ubuntu-latest | |
| needs: [packages, setup, release-please] | |
| steps: | |
| - name: Use "dist" cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ./* | |
| ~/.pnpm-store | |
| key: ${{ github.sha }}-dist-production-core-react | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.12.0' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Publish base packages (utils, tokens, icons) | |
| run: | | |
| pnpm config set '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_TOKEN }} | |
| pnpm --filter @equinor/eds-utils publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" | |
| pnpm --filter @equinor/eds-tokens publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" | |
| pnpm --filter @equinor/eds-icons publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" | |
| - name: log-errors-to-slack | |
| uses: act10ns/slack@v2 | |
| with: | |
| status: ${{ job.status }} | |
| steps: ${{ toJson(steps) }} | |
| if: failure() | |
| publish-react-packages: | |
| if: ${{ needs.release-please.outputs.releases_created }} | |
| name: Publish React packages to npm | |
| runs-on: ubuntu-latest | |
| needs: [publish-base-packages, setup, release-please] | |
| steps: | |
| - name: Use "dist" cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ./* | |
| ~/.pnpm-store | |
| key: ${{ github.sha }}-dist-production-core-react | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.12.0' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Publish React packages | |
| run: | | |
| pnpm config set '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_TOKEN }} | |
| pnpm --filter @equinor/eds-core-react publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" | |
| pnpm --filter @equinor/eds-data-grid-react publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" | |
| pnpm --filter @equinor/eds-lab-react publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" | |
| - name: log-errors-to-slack | |
| uses: act10ns/slack@v2 | |
| with: | |
| status: ${{ job.status }} | |
| steps: ${{ toJson(steps) }} | |
| if: failure() | |
| publish-storybook: | |
| if: ${{ needs.release-please.outputs.releases_created }} | |
| needs: [publish-react-packages, release-please] | |
| name: Build & Deploy Website | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| steps: | |
| - name: Use cache with storybook files | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ./* | |
| ~/.pnpm-store | |
| key: ${{ github.sha }}-dist-production-core-react | |
| - name: Deploy the website | |
| uses: tibor19/static-website-deploy@v2 | |
| with: | |
| enabled-static-website: 'true' | |
| folder: 'packages/eds-core-react/storybook-build' | |
| public-access-policy: 'container' | |
| connection-string: ${{ secrets.AZ_STORYBOOK_CONNECTION_STRING }} | |
| - name: log-errors-to-slack | |
| uses: act10ns/slack@v2 | |
| with: | |
| status: ${{ job.status }} | |
| steps: ${{ toJson(steps) }} | |
| if: failure() | |
| purge-cdn: | |
| if: ${{ needs.release-please.outputs.releases_created }} | |
| needs: [publish-storybook, release-please] | |
| name: Purge cdn | |
| uses: ./.github/workflows/_purge_cdn.yaml | |
| secrets: inherit | |
| with: | |
| environment: production | |
| endpoint: storybook |