Deploy conventional #159
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: CD | |
| concurrency: production | |
| on: | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| type: choice | |
| required: true | |
| description: Version | |
| options: | |
| - conventional | |
| - patch | |
| - minor | |
| - major | |
| - prerelease | |
| - from-package | |
| - from-git | |
| prerelease: | |
| type: choice | |
| description: Pre-release | |
| options: | |
| - | |
| - canary | |
| - beta | |
| dryrun: | |
| description: 'Dry-run' | |
| type: boolean | |
| run-name: Deploy ${{ inputs.version }} ${{ inputs.dryrun && '--dry-run' || '' }} ${{ inputs.prerelease && format('--prerelease {0}', inputs.prerelease) || '' }} | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: production | |
| permissions: | |
| contents: write | |
| id-token: write | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all tags and branches | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| # this line is required for the setup-node action to be able to run the npm publish below. | |
| registry-url: 'https://registry.npmjs.org' | |
| - uses: fregante/setup-git-user@v1 | |
| - run: npm ci | |
| - run: npm run lint | |
| # Install Playwright after linting, so that we have a faster linting process. | |
| # Caching logic adapted from https://github.com/microsoft/playwright/issues/7249#issuecomment-1385567519 | |
| - name: Store Playwright's Version | |
| run: | | |
| PLAYWRIGHT_VERSION=$(npm view @web/test-runner-playwright dependencies.playwright) | |
| echo "Playwright's Version: $PLAYWRIGHT_VERSION" | |
| echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | |
| - name: Cache Playwright Browsers for Playwright's Version | |
| id: cache-playwright-browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} | |
| - run: npx playwright install --with-deps | |
| if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | |
| - run: npx playwright install-deps | |
| if: steps.cache-playwright-browsers.outputs.cache-hit == 'true' | |
| - run: npm test -- --all | |
| - run: npm run manifest | |
| - run: npm run build | |
| - run: npx --yes wet-run@1.2.2 release ${{ inputs.version }} ${{ inputs.dryrun && '--dry-run' || '' }} ${{ inputs.prerelease && format('--prerelease {0}', inputs.prerelease) || '' }} --provenance --changelog --github-release --log-level verbose | |
| - name: Get NPM version | |
| id: npm-version | |
| uses: martinbeentjes/npm-get-version-action@v1.3.1 | |
| - name: Released ${{ steps.npm-version.outputs.current-version}} ✨ | |
| run: echo ${{ steps.npm-version.outputs.current-version}} |