forked from yext/studio
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (80 loc) · 2.81 KB
/
release.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
name: Release Studio
on:
push:
# branches: main
jobs:
check-for-release:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.check_versions.conclusion }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: check commit name
id: vars
run: |
COMMIT_MSG="${{ github.event.head_commit.message }}"
COMMIT_TITLE="${COMMIT_MSG%%$'\n'*}"
if [[ $COMMIT_TITLE =~ ^(v|Version )[0-9]+\.[0-9]+\.[0-9]+( \(#[0-9]+\))?$ ]]
then
PACKAGE_VERSION="${COMMIT_TITLE#Version }"
PACKAGE_VERSION="${PACKAGE_VERSION#v}"
PACKAGE_VERSION="${PACKAGE_VERSION%% *}"
echo version=${PACKAGE_VERSION} >> $GITHUB_OUTPUT
echo should_continue=1 >> ${GITHUB_OUTPUT}
else
echo should_continue=0 >> ${GITHUB_OUTPUT}
fi
- name: check package versions
id: check_versions
if: steps.vars.outputs.should_continue == 1
run: |
if node ./bump-versions.mjs ${{ steps.vars.outputs.version }} &> temp-bump-versions.txt
then
echo "Package versions did not match ${{ steps.vars.outputs.version }}."
exit 1
fi
if
grep -zq 'bumping studio-plugin.npm ERR! Version not changed' temp-bump-versions.txt &&
grep -zq 'bumping studio-ui.npm ERR! Version not changed' temp-bump-versions.txt &&
grep -zq 'bumping studio.npm ERR! Version not changed' temp-bump-versions.txt
then
if git diff --exit-code
then
exit 0
fi
echo "Found unexpected git diff from running the bump-versions.mjs script."
exit 1
fi
echo "Error running the bump-version.mjs script."
cat temp-bump-versions.txt
exit 1
check-linting:
needs: check-for-release
runs-on: ubuntu-latest
if: needs.check-for-release.outputs.status == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/setup-ci
- name: eslint check
run: npx eslint --max-warnings=0 .
- name: prettier check
run: npx prettier --check .
- name: cancel workflow
if: ${{ failure() }}
run: gh run cancel ${{ github.run_id }}
run-tests:
needs: check-for-release
if: needs.check-for-release.outputs.status == 'success'
uses: ./.github/workflows/run-tests.yml
run-acceptance:
needs: check-for-release
if: needs.check-for-release.outputs.status == 'success'
uses: ./.github/workflows/playwright.yml
with:
test_script: npm run playwright
call-publish:
needs: [check-linting, run-tests, run-acceptance]
uses: ./.github/workflows/publish-hold.yml