-
Notifications
You must be signed in to change notification settings - Fork 10
92 lines (85 loc) · 2.63 KB
/
cron.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
89
90
91
92
name: Scheduled Workflow
on:
schedule:
- cron: '0 0 * * *'
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'yarn'
- name: Install Deps & Run Tests
run: yarn install --frozen-lockfile && yarn test:ci
update_list:
name: Modify TokenList
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'yarn'
- name: Run Script
run: |
yarn install --frozen-lockfile
chmod +x ./run.sh
./run.sh
npm run prettier
shell: bash
- name: Commit Update
run: |
git config user.name github-actions
git config user.email [email protected]
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
if [ -n "$(git status --porcelain)" ]; then
git pull
git checkout -f "Automated-TokenList-Update"
./run.sh
npm run prettier
git add .
git commit -m "Updated TokenList" ||echo "Branch is up to date"
git push -u origin "Automated-TokenList-Update"
gh pr create -B main -H Automated-TokenList-Update --title 'TokenList Updated' --body 'PR created by Github Actions. Review PR and add changeset to release' || echo "PR already exists"
else
echo "Repo is clean"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
with:
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}