-
Notifications
You must be signed in to change notification settings - Fork 61
82 lines (67 loc) · 2.37 KB
/
build.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
name: Build
on:
workflow_dispatch:
schedule:
- cron: '0 7 * * *'
push:
branches:
- master
jobs:
build:
if: contains(github.event.commits[0].message, '[skip ci]') == false &&
github.repository == 'roblox-ts/types' &&
github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install NodeJS
uses: actions/setup-node@master
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- uses: bahmutov/npm-install@v1
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Generate Files
run: npm run build
- name: Push Generated Files
run: |
git add -A
if ! git diff-index --quiet HEAD --; then
echo "Generated files changed!"
git commit -m "Update generated files [skip ci]"
git push https://osyrisrblx:${{ secrets.github_token }}@github.com/roblox-ts/types.git HEAD:master
fi
- name: Copy Files to Deploy Branch and Publish
run: |
cd ..
git clone --depth=50 --branch=deploy https://osyrisrblx:${{ secrets.github_token }}@github.com/roblox-ts/types.git deploy
mkdir -p deploy/include
rm -rf deploy/include/*
cp -r types/include/* deploy/include
cp types/plugin.d.ts deploy/plugin.d.ts
cp types/README.md deploy/README.md
cd deploy
git add -A
if ! git diff-index --quiet HEAD --; then
echo "Deploy changed!"
if [ "$GITHUB_EVENT_NAME" == "push" ]; then
git commit -m "Manual Update"
else
git commit -m "Automatic Update"
fi
npm version patch -m "package.json version bump to %s [skip ci]"
git push https://osyrisrblx:${{ secrets.github_token }}@github.com/roblox-ts/types.git HEAD:deploy
npm publish
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
- name: Send Build Failure Notification
uses: rjstone/discord-webhook-notify@v1
if: failure()
with:
severity: error
details: Build Failed!
webhookUrl: ${{ secrets.WEBHOOK_URL }}