generated from maxisam/github-ts-action-template
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (60 loc) · 1.74 KB
/
CI.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
name: "🌞 CI"
on:
workflow_dispatch:
pull_request:
paths-ignore:
- "**.md"
- dist/**
- __tests__/dotnet/**
push:
branches:
- main
paths-ignore:
- "**.md"
- dist/**
- __tests__/dotnet/**
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
- name: Set Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: "yarn"
- run: yarn install
- run: |
yarn all
- name: Compare the expected and actual dist/ directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
echo "diff=true" >> $GITHUB_ENV
else
echo "diff=false" >> $GITHUB_ENV
fi
- name: commit build
id: commit
if: ${{ env.diff == 'true' }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "maxisam"
git add dist/
git commit -m "chore: build, dist updated"
git push origin ${{ github.event.pull_request.head.ref || github.ref_name }}
sha=$(git rev-parse HEAD)
echo "sha=$sha" >> $GITHUB_OUTPUT
- name: Status update
if: ${{ env.diff == 'true' }}
uses: myrotvorets/[email protected]
with:
status: "success"
sha: ${{ steps.commit.outputs.sha }}
description: "Build Dist Updated"
context: "Build Dist Updated"