ELEMENTS-1676: fix made actions at bottom of nuxeo-data-grid operable using keyboard #1677
Workflow file for this run
This file contains 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: Preview | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, labeled] | |
branches: | |
- maintenance-3.1.x | |
env: | |
DOCKER_REGISTRY: us-east1-docker.pkg.dev | |
DOCKER_IMAGE: ${{ secrets.GKE_PROJECT }}/webui/nuxeo-elements/storybook | |
GKE_CLUSTER: jx-prod | |
GKE_ZONE: us-east1-b | |
jobs: | |
storybook: | |
name: Storybook | |
if: (github.event.action == 'labeled' && github.event.label.name == 'preview') || contains(github.event.pull_request.labels.*.name, 'preview') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
registry-url: 'https://packages.nuxeo.com/repository/npm-public/' | |
scope: '@nuxeo' | |
- name: Prepare environment | |
run: | | |
BRANCH_NAME=${GITHUB_HEAD_REF##*/} | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
echo "VERSION=$(npx -c 'echo "$npm_package_version"')-$BRANCH_NAME" >> $GITHUB_ENV | |
echo "PREVIEW_NAMESPACE=storybook-$(echo $BRANCH_NAME | sed 's/[^[:alnum:]-]/-/g' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Install | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }} | |
run: | | |
npm install --no-package-lock | |
npm run bootstrap | |
- name: Run analysis | |
run: npx lerna run analysis --parallel | |
- name: Build storybook | |
working-directory: ./storybook | |
run: | | |
npx build-storybook -o dist -s ./public | |
- name: Build and push image | |
uses: docker/build-push-action@v1 | |
with: | |
registry: ${{ env.DOCKER_REGISTRY }} | |
username: _json_key | |
password: ${{ secrets.GKE_SA_KEY }} | |
path: ./storybook | |
push: true | |
repository: ${{ env.DOCKER_IMAGE }} | |
tags: ${{ env.VERSION }} | |
- name: Get GKE credentials | |
uses: google-github-actions/[email protected] | |
with: | |
cluster_name: ${{ env.GKE_CLUSTER }} | |
location: ${{ env.GKE_ZONE }} | |
project_id: ${{ secrets.GKE_PROJECT }} | |
credentials: ${{ secrets.GKE_SA_KEY }} | |
- name: Check preview namespace | |
id: preview_ns | |
run: | | |
echo ::set-output name=exists::$(kubectl get namespace ${PREVIEW_NAMESPACE}) | |
# Previous preview deployment needs to be scaled to 0 to be replaced correctly | |
# - name: Cleanup preview namespace | |
# if: ${{ steps.preview_ns.outputs.exists }} | |
# continue-on-error: true | |
# run: | | |
# kubectl -n ${PREVIEW_NAMESPACE} scale deployment preview --replicas=0 | |
- name: Create preview namespace | |
if: ${{ !steps.preview_ns.outputs.exists }} | |
run: | | |
kubectl create namespace ${PREVIEW_NAMESPACE} | |
- name: Install preview | |
id: preview | |
working-directory: ./storybook/charts/preview | |
run: | | |
# install Helm | |
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash - | |
helm repo add jx https://jenkins-x-charts.github.io/v2/ | |
# substitute env variables in values.yaml | |
mv values.yaml values.yaml.tosubst | |
envsubst < values.yaml.tosubst > values.yaml | |
# update helm deps | |
helm dependency update . | |
# install | |
helm upgrade --install --namespace ${PREVIEW_NAMESPACE} preview . | |
echo "PREVIEW_URL=https://preview-${PREVIEW_NAMESPACE}.webui.dev.nuxeo.com" >> $GITHUB_ENV | |
- uses: actions/[email protected] | |
if: github.event_name == 'pull_request' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `:star: Storybook preview available [here](${process.env.PREVIEW_URL})` | |
}) | |
webui-preview: | |
name: Web UI | |
runs-on: ubuntu-latest | |
if: (github.event.action == 'labeled' && github.event.label.name == 'webui-preview') || contains(github.event.pull_request.labels.*.name, 'webui-preview') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prepare environment | |
run: | | |
echo "BRANCH_NAME=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV | |
- name: Web UI preview | |
id: main | |
uses: nuxeo/ui-team-gh-actions/trigger-workflow@a5b89f35e0d1f3a912f528d7f1c3acdb73c60549 | |
with: | |
owner: nuxeo | |
repo: nuxeo-web-ui | |
workflow-id: preview.yaml | |
access-token: ${{ secrets.WEBUI_ACCESS_TOKEN_PERSONAL }} | |
branch-name: maintenance-3.1.x | |
inputs: | | |
branch_name: ${{ env.BRANCH_NAME }} | |
- uses: actions/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `:star: Web UI preview available [here](${{ steps.main.outputs.message }})` | |
}) |