Skip to content

Create snapshot release from 42d0b81bf81b367f330713cd824880fe448dafd3 by tkajtoch #30

Create snapshot release from 42d0b81bf81b367f330713cd824880fe448dafd3 by tkajtoch

Create snapshot release from 42d0b81bf81b367f330713cd824880fe448dafd3 by tkajtoch #30

Workflow file for this run

name: Release packages (Work in Progress, a dry run only)
run-name: "Create ${{ inputs.type }} release from ${{ 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 npm@latest && 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 }}