@@ -3,12 +3,16 @@ name: Mosaic CI - Release
33on :
44 push :
55 branches :
6- - master
6+ - main
7+
8+ concurrency :
9+ group : release
10+ cancel-in-progress : true
711
812jobs :
913 release :
10- runs-on : ubuntu-latest
11- steps :
14+ runs-on : ubuntu-22.04
15+ steps :
1216 - name : Checkout
1317 uses : actions/checkout@v3
1418 with :
1721 - name : Install NodeJS
1822 uses : actions/setup-node@v3
1923 with :
20- node-version : lts/gallium
24+ node-version : lts/iron
2125
2226 - name : Cache Dependencies
2327 id : cache-dependencies
@@ -38,19 +42,14 @@ jobs:
3842 git config --local user.name "${{ secrets.GIT_USER_NAME }}"
3943 git pull
4044
41- - name : Unit Tests
42- run : npm run test:coverage
43- env :
44- CI : true
45-
4645 - name : Run ESLint and Prettier
4746 id : code-format
4847 run : |
4948 npm run clean:code
5049 git add .
51- echo "::set-output name= formatted-files:: $(git status -s -uno | wc -l)"
50+ echo "formatted-files= $(git status -s -uno | wc -l)" >> $GITHUB_OUTPUT
5251
53- - name : Commit Changes
52+ - name : Commit Format
5453 if : steps.code-format.outputs.formatted-files > 0
5554 run : |
5655 git commit -m "refactor: 💡 Clean code" -a
@@ -60,26 +59,44 @@ jobs:
6059 run : |
6160 npm run build:storybook
6261 git add .
63- echo "::set-output name= generated-docs:: $(git status -s -uno | wc -l)"
62+ echo "generated-docs= $(git status -s -uno | wc -l)" >> $GITHUB_OUTPUT
6463
65- - name : Commit Changes
64+ - name : Commit Docs
6665 if : steps.generate-docs.outputs.generated-docs > 0
6766 run : |
6867 git commit -m "docs: ✏️ Updated StoryBook" -a
6968
69+ - name : Test runner
70+ id : test-runner
71+ run : |
72+ npx playwright install --with-deps
73+ npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
74+ "npx http-server docs/latest --port 6006 --silent" \
75+ "npx wait-on tcp:127.0.0.1:6006 && npm run test:ci"
76+ echo "components-db=$(git status -s -uno | wc -l)" >> $GITHUB_OUTPUT
77+
78+ - name : Commit Database
79+ if : steps.test-runner.outputs.components-db > 0
80+ run : |
81+ git commit -m "docs: ✏️ Updated components database" -a
82+
7083 - name : Build
7184 run : npm run build
7285
7386 - name : Release
7487 env :
88+ GIT_AUTHOR_EMAIL : ${{ secrets.GIT_USER_EMAIL }}
89+ GIT_AUTHOR_NAME : ${{ secrets.GIT_USER_NAME }}
90+ GIT_COMMITTER_EMAIL : ${{ secrets.GIT_USER_EMAIL }}
91+ GIT_COMMITTER_NAME : ${{ secrets.GIT_USER_NAME }}
7592 GITHUB_TOKEN : ${{ secrets.PA_TOKEN }}
7693 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
7794 run : npx semantic-release
7895
7996 - name : Send Notification
8097 uses : Co-qn/google-chat-notification@master
8198 with :
82- name : Mosaic CI - Release
99+ name : ${{ github.workflow }}
83100 url : ${{ secrets.GOOGLE_CHAT }}
84101 status : ${{ job.status }}
85102 if : always()
0 commit comments