|
| 1 | +name: Release Please |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - fre/release-please |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + pull-requests: write |
| 10 | + |
| 11 | +env: |
| 12 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 13 | + |
| 14 | +jobs: |
| 15 | + release-please: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + outputs: |
| 18 | + releases_created: ${{ steps.release.outputs.releases_created }} |
| 19 | + release_data: ${{ steps.release.outputs.releases_created && steps.release.outputs }} |
| 20 | + steps: |
| 21 | + - uses: googleapis/release-please-action@v4 |
| 22 | + id: release |
| 23 | + with: |
| 24 | + config-file: .github/release-please-config.json |
| 25 | + manifest-file: .github/.release-please-manifest.json |
| 26 | + |
| 27 | + setup: |
| 28 | + if: ${{ needs.release-please.outputs.releases_created }} |
| 29 | + needs: release-please |
| 30 | + uses: ./.github/workflows/_setup.yml |
| 31 | + secrets: inherit |
| 32 | + with: |
| 33 | + cacheKey: ${{ github.sha }} |
| 34 | + checkout_paths: packages |
| 35 | + tag: latest # Automatisk publisering bruker 'latest' tag |
| 36 | + |
| 37 | + packages: |
| 38 | + if: ${{ needs.release-please.outputs.releases_created }} |
| 39 | + name: Process packages |
| 40 | + runs-on: ubuntu-latest |
| 41 | + needs: [setup, release-please] |
| 42 | + steps: |
| 43 | + - name: Use "setup" cache |
| 44 | + uses: actions/cache@v4 |
| 45 | + with: |
| 46 | + path: | |
| 47 | + ./* |
| 48 | + ~/.pnpm-store |
| 49 | + key: ${{ github.sha }} |
| 50 | + - name: Use "dist" cache |
| 51 | + uses: actions/cache@v4 |
| 52 | + with: |
| 53 | + path: | |
| 54 | + ./* |
| 55 | + ~/.pnpm-store |
| 56 | + key: ${{ github.sha }}-dist-production-core-react |
| 57 | + - name: Install Node.js |
| 58 | + uses: actions/setup-node@v4 |
| 59 | + with: |
| 60 | + node-version: '22.12.0' |
| 61 | + - name: Setup pnpm |
| 62 | + uses: pnpm/action-setup@v4 |
| 63 | + with: |
| 64 | + run_install: false |
| 65 | + - name: Build packages |
| 66 | + run: pnpm run build |
| 67 | + - name: Build Storybook |
| 68 | + run: pnpm build:storybook |
| 69 | + - name: log-errors-to-slack |
| 70 | + uses: act10ns/slack@v2 |
| 71 | + with: |
| 72 | + status: ${{ job.status }} |
| 73 | + steps: ${{ toJson(steps) }} |
| 74 | + if: failure() |
| 75 | + |
| 76 | + publish-base-packages: |
| 77 | + if: ${{ needs.release-please.outputs.releases_created }} |
| 78 | + name: Publish base packages to npm |
| 79 | + runs-on: ubuntu-latest |
| 80 | + needs: [packages, setup, release-please] |
| 81 | + steps: |
| 82 | + - name: Use "dist" cache |
| 83 | + uses: actions/cache@v4 |
| 84 | + with: |
| 85 | + path: | |
| 86 | + ./* |
| 87 | + ~/.pnpm-store |
| 88 | + key: ${{ github.sha }}-dist-production-core-react |
| 89 | + - name: Install Node.js |
| 90 | + uses: actions/setup-node@v4 |
| 91 | + with: |
| 92 | + node-version: '22.12.0' |
| 93 | + - name: Setup pnpm |
| 94 | + uses: pnpm/action-setup@v4 |
| 95 | + with: |
| 96 | + run_install: false |
| 97 | + - name: Publish base packages (utils, tokens, icons) |
| 98 | + run: | |
| 99 | + pnpm config set '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_TOKEN }} |
| 100 | + pnpm --filter @equinor/eds-utils publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" |
| 101 | + pnpm --filter @equinor/eds-tokens publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" |
| 102 | + pnpm --filter @equinor/eds-icons publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" |
| 103 | + - name: log-errors-to-slack |
| 104 | + uses: act10ns/slack@v2 |
| 105 | + with: |
| 106 | + status: ${{ job.status }} |
| 107 | + steps: ${{ toJson(steps) }} |
| 108 | + if: failure() |
| 109 | + |
| 110 | + publish-react-packages: |
| 111 | + if: ${{ needs.release-please.outputs.releases_created }} |
| 112 | + name: Publish React packages to npm |
| 113 | + runs-on: ubuntu-latest |
| 114 | + needs: [publish-base-packages, setup, release-please] |
| 115 | + steps: |
| 116 | + - name: Use "dist" cache |
| 117 | + uses: actions/cache@v4 |
| 118 | + with: |
| 119 | + path: | |
| 120 | + ./* |
| 121 | + ~/.pnpm-store |
| 122 | + key: ${{ github.sha }}-dist-production-core-react |
| 123 | + - name: Install Node.js |
| 124 | + uses: actions/setup-node@v4 |
| 125 | + with: |
| 126 | + node-version: '22.12.0' |
| 127 | + - name: Setup pnpm |
| 128 | + uses: pnpm/action-setup@v4 |
| 129 | + with: |
| 130 | + run_install: false |
| 131 | + - name: Publish React packages |
| 132 | + run: | |
| 133 | + pnpm config set '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_TOKEN }} |
| 134 | + pnpm --filter @equinor/eds-core-react publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" |
| 135 | + pnpm --filter @equinor/eds-data-grid-react publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" |
| 136 | + pnpm --filter @equinor/eds-lab-react publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks || echo "Package not changed" |
| 137 | + - name: log-errors-to-slack |
| 138 | + uses: act10ns/slack@v2 |
| 139 | + with: |
| 140 | + status: ${{ job.status }} |
| 141 | + steps: ${{ toJson(steps) }} |
| 142 | + if: failure() |
| 143 | + |
| 144 | + publish-storybook: |
| 145 | + if: ${{ needs.release-please.outputs.releases_created }} |
| 146 | + needs: [publish-react-packages, release-please] |
| 147 | + name: Build & Deploy Website |
| 148 | + runs-on: ubuntu-latest |
| 149 | + environment: |
| 150 | + name: production |
| 151 | + steps: |
| 152 | + - name: Use cache with storybook files |
| 153 | + uses: actions/cache@v4 |
| 154 | + with: |
| 155 | + path: | |
| 156 | + ./* |
| 157 | + ~/.pnpm-store |
| 158 | + key: ${{ github.sha }}-dist-production-core-react |
| 159 | + - name: Deploy the website |
| 160 | + uses: tibor19/static-website-deploy@v2 |
| 161 | + with: |
| 162 | + enabled-static-website: 'true' |
| 163 | + folder: 'packages/eds-core-react/storybook-build' |
| 164 | + public-access-policy: 'container' |
| 165 | + connection-string: ${{ secrets.AZ_STORYBOOK_CONNECTION_STRING }} |
| 166 | + - name: log-errors-to-slack |
| 167 | + uses: act10ns/slack@v2 |
| 168 | + with: |
| 169 | + status: ${{ job.status }} |
| 170 | + steps: ${{ toJson(steps) }} |
| 171 | + if: failure() |
| 172 | + |
| 173 | + purge-cdn: |
| 174 | + if: ${{ needs.release-please.outputs.releases_created }} |
| 175 | + needs: [publish-storybook, release-please] |
| 176 | + name: Purge cdn |
| 177 | + uses: ./.github/workflows/_purge_cdn.yaml |
| 178 | + secrets: inherit |
| 179 | + with: |
| 180 | + environment: production |
| 181 | + endpoint: storybook |
0 commit comments