Skip to content

deps: breaking: update @typescript-eslint dependencies #2239

deps: breaking: update @typescript-eslint dependencies

deps: breaking: update @typescript-eslint dependencies #2239

Workflow file for this run

name: Canary deployment
on:
pull_request:
types: [labeled, synchronize]
paths:
- 'packages/**/*'
jobs:
publish-canary:
name: 'publish canary'
runs-on: ubuntu-latest
if: contains(join(github.event.pull_request.labels.*.name), 'packages/')
steps:
- uses: actions/checkout@v2-beta
- name: Extract package name
id: name
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN_REPO_WRITE }}
previews: 'ant-man-preview,flash-preview'
script: |
const { data: pullLabels } = await github.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
per_page: 100,
});
const labels = pullLabels.map(label => label.name);
const packageLabels = labels.filter(name => name.includes('packages/'));
console.log(`::debug ::${packageLabels.length} matching labels`);
if (packageLabels.length > 1) {
throw new Error('Pull request should have only one package label');
}
if (packageLabels.length === 1) {
console.log(`::set-output name=package::${packageLabels[0]}`)
return;
}
throw new Error('Pull request is not labeled with packages, should not be here');
- name: Compute canary version
id: compute-version
env:
# TODO - concat check-suite run id when added by Github to prevent
# conflict when re-running workflow on the same commit
PACKAGE: ${{ steps.name.outputs.package }}
run: |
cd $PACKAGE
COMMIT=$(git rev-parse --short HEAD)
NOW=$(date +%s%3N)
CURRENT_VERSION=$(cat package.json | jq -r '.version')
NEW_VERSION=$CURRENT_VERSION-canary-$COMMIT-$NOW
NAME=$(cat package.json | jq -r '.name')
echo "::set-output name=version::$NEW_VERSION"
echo "::set-output name=name::$NAME"
- uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org/
node-version: '16'
- name: Cache npm cache
uses: actions/cache@v1
with:
path: ~/.npm
key: v1-npm-${{ github.event.pull_request.head.ref }}-${{ hashFiles(format('{0}/package-lock.json', steps.name.outputs.package)) }}
restore-keys: |
v1-npm-${{ github.event.pull_request.head.ref }}-
v1-npm-
- name: Install
if: steps.node-modules-cache.outputs.cache-hit != 'true'
env:
PACKAGE: ${{ steps.name.outputs.package }}
run: |
cd $PACKAGE
npm ci
- name: Bumb version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
VERSION: ${{ steps.compute-version.outputs.version }}
PACKAGE: ${{ steps.name.outputs.package }}
run: |
cd $PACKAGE
npm version --no-git-tag-version $VERSION
- name: Create deployment
id: deployment
uses: actions/[email protected]
env:
NAME: ${{ steps.compute-version.outputs.name }}
VERSION: ${{ steps.compute-version.outputs.version }}
DIRECTORY: ${{ steps.name.outputs.package }}
with:
github-token: ${{ secrets.GITHUB_TOKEN_REPO_WRITE }}
previews: 'ant-man-preview,flash-preview'
script: |
const name = process.env.NAME;
const version = process.env.VERSION;
const directory = process.env.DIRECTORY;
const branch = context.payload.pull_request.head.ref;
const { data: deployment } = await github.repos.createDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
ref: branch,
environment: 'npm',
auto_merge: false,
required_contexts: [],
payload: {
version,
name,
directory,
ref: context.payload.pull_request.head.sha,
npmTag: branch,
},
description: `Deploy ${name}@${version} on npm`,
production_environment: true,
});