-
Notifications
You must be signed in to change notification settings - Fork 4
88 lines (74 loc) · 2.67 KB
/
checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Checks
on:
pull_request:
paths-ignore:
- "**.md"
push:
branches:
# latest release
- main
# maintenance releases
- v[0-9]+.x.x
- v[0-9]+.[0-9]+.x
env:
CI: true
RELEASE_TITLE: ""
jobs:
pipeline:
name: Checks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile --prefer-offline
- name: Check if there are any uncommitted changes
run: |
git diff --name-only --exit-code --relative || (echo "\nUncommitted changes found up there 👆" && exit 1)
- name: Detect file changes
id: changed-files
uses: tj-actions/changed-files@v41
with:
files_yaml: |
eslint_config:
- .eslintrc.js
- .eslintignore
- yarn.lock
eslint_target:
- "**/*.{ts,js,vue}"
- name: Lint all files
id: lint-all
if: ${{ github.event_name == 'push' || steps.changed-files.outputs.eslint_config_any_changed == 'true' }}
run: yarn lint .
- name: Lint changed files
if: ${{ steps.lint-all.outcome == 'skipped' && steps.changed-files.outputs.eslint_target_any_changed == 'true' }}
run: yarn lint ${{ steps.changed-files.outputs.eslint_target_all_changed_files }} --no-error-on-unmatched-pattern
- name: Build observability package
run: yarn build-pkg observability
- name: Assign release title
if: github.repository_owner == 'StackVista'
run: |
yarn changeset status \
--since origin/$(jq -r '.baseBranch' .changeset/config.json) \
--output changeset-status.json
export TITLE=$(jq -r '"Release " + ([.releases[] | "`\(.name)@\(.oldVersion) -> \(.newVersion)`"] | join(", "))' changeset-status.json)
echo "RELEASE_TITLE=$TITLE" >> $GITHUB_ENV
# creates a PR if there are changesets or publishes the changesets if the PR is merged
- name: Create Release Pull Request OR Publish
if: env.RELEASE_TITLE != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# prevents this step from running on forks AND only on pushes and .changeset.baseBranch is the target branch
uses: changesets/action@v1
with:
title: ${{ env.RELEASE_TITLE }}
commit: ${{ env.RELEASE_TITLE}}
publish: echo "Create Release"
branch: main