Create official release from main (cd5a22326d609cb642dfd20d9195993d24df3105) by tkajtoch #40
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 packages | |
| run-name: "Create ${{ inputs.type }} release from ${{ github.ref_name }} (${{ inputs.release_ref }}) by ${{ github.actor }}" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_ref: | |
| description: Upstream git ref to create the release from | |
| required: true | |
| type: string | |
| type: | |
| description: Release type | |
| required: true | |
| type: choice | |
| options: | |
| - snapshot | |
| - official | |
| workspaces: | |
| description: A comma-separated list of workspaces to release | |
| required: false | |
| type: string | |
| dry_run: | |
| description: Dry run (do not publish the packages) | |
| required: true | |
| type: boolean | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| jobs: | |
| lint_and_unit_tests: | |
| name: Run lint and unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.release_ref }} | |
| persist-credentials: false | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Build local packages | |
| run: yarn workspaces foreach --all --parallel --topological-dev --exclude @elastic/eui-website --exclude @elastic/eui-monorepo --exclude @elastic/eui-docgen run build | |
| - name: Lint | |
| run: yarn workspaces foreach --all --parallel --topological-dev --exclude @elastic/eui-website --exclude @elastic/eui-monorepo --exclude @elastic/eui-docgen run lint | |
| - name: Unit tests | |
| run: yarn workspaces foreach --all --parallel --topological-dev --exclude @elastic/eui-website --exclude @elastic/eui-monorepo --exclude @elastic/eui-docgen run test-unit | |
| cypress_tests: | |
| name: Run cypress tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.release_ref }} | |
| persist-credentials: false | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Build local packages | |
| run: yarn workspaces foreach --all --parallel --topological-dev --exclude @elastic/eui-website --exclude @elastic/eui-monorepo --exclude @elastic/eui-docgen run build | |
| - name: Cypress tests | |
| run: yarn workspaces foreach --all --parallel --topological-dev --exclude @elastic/eui-website --exclude @elastic/eui-monorepo --exclude @elastic/eui-docgen run test-cypress | |
| release_snapshot: | |
| name: Create a snapshot release | |
| runs-on: ubuntu-latest | |
| if: ${{ inputs.type == 'snapshot' }} | |
| needs: [ lint_and_unit_tests, cypress_tests ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.release_ref }} | |
| # This is needed for yarn version to work properly, but it increases fetch time. | |
| # We can change this back to "1" if we replace yarn version with something else | |
| fetch-depth: 0 | |
| - name: Configure git | |
| run: | | |
| git config --global user.name 'EUI Machine' | |
| git config --global user.email '[email protected]' | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: yarn | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm install -g [email protected] && yarn install --immutable | |
| - name: Build release scripts | |
| run: yarn workspace @elastic/eui-release-cli run build | |
| - name: Rename git remote to upstream | |
| run: git remote rename origin upstream | |
| - name: Prepare list of workspaces | |
| id: prepare_workspaces_arg | |
| uses: actions/github-script@v8 | |
| env: | |
| WORKSPACES: ${{ inputs.workspaces }} | |
| with: | |
| # language=javascript | |
| script: | | |
| if (!process.env.WORKSPACES || typeof process.env.WORKSPACES !== 'string') { | |
| return ''; | |
| } | |
| return `--workspaces ${process.env.WORKSPACES.split(',').join(' ')}`; | |
| result-encoding: string | |
| - name: Release | |
| run: yarn release run snapshot --skip-prompts --skip-auth-check --use-auth-token --allow-custom ${{ inputs.dry_run && '--dry-run' || ''}} ${{ steps.prepare_workspaces_arg.outputs.result }} | |
| release_official: | |
| name: Create an official release | |
| runs-on: ubuntu-latest | |
| if: ${{ inputs.type == 'official' }} | |
| needs: [ lint_and_unit_tests, cypress_tests ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.release_ref }} | |
| # This is needed for yarn version to work properly, but it increases fetch time. | |
| # We can change this back to "1" if we replace yarn version with something else | |
| fetch-depth: 0 | |
| - name: Verify release commit is tagged | |
| run: | | |
| tag=$(git tag --points-at ${{ inputs.release_ref }}) | |
| if [[ "$?" -ne 0 ]] || [[ -z "$tag" ]]; then | |
| echo "::error:: Release ref does not point to any tag. Please tag the merge commit of the release PR and try again" | |
| exit 1 | |
| else | |
| echo "Release commit verified - $tag" | |
| fi | |
| - name: Configure git | |
| run: | | |
| git config --global user.name 'EUI Machine' | |
| git config --global user.email '[email protected]' | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: yarn | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm install -g [email protected] && yarn install --immutable | |
| - name: Build release scripts | |
| run: yarn workspace @elastic/eui-release-cli run build | |
| - name: Rename git remote to upstream | |
| run: git remote rename origin upstream | |
| - name: Prepare list of workspaces | |
| id: prepare_workspaces_arg | |
| uses: actions/github-script@v8 | |
| env: | |
| WORKSPACES: ${{ inputs.workspaces }} | |
| with: | |
| # language=javascript | |
| script: | | |
| if (!process.env.WORKSPACES || typeof process.env.WORKSPACES !== 'string') { | |
| return ''; | |
| } | |
| return `--workspaces ${process.env.WORKSPACES.split(',').join(' ')}`; | |
| result-encoding: string | |
| - name: Release | |
| run: yarn release run official --skip-prompts --skip-auth-check --use-auth-token --allow-custom --skip-update-versions ${{ inputs.dry_run && '--dry-run' || ''}} ${{ steps.prepare_workspaces_arg.outputs.result }} |