-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.54 KB
/
update_formula.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
name: Update Formula
on:
repository_dispatch:
types: [start-deploy]
workflow_dispatch: # Allows manual trigger
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.AUTOMATION_USER_TOKEN }}
fetch-depth: 0
- name: Set Node.js version
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Get latest version and shasum
id: npm_data
run: |
TARBALL_URL=$(npm show @devcycle/cli dist.tarball)
LATEST_VERSION=$(npm show @devcycle/cli version)
SHA=$(curl -Ls ${TARBALL_URL} | shasum -a 256 | awk '{print $1}')
echo "Latest version: $LATEST_VERSION"
echo "SHA: $SHA"
echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT
echo "sha=$SHA" >> $GITHUB_OUTPUT
- name: Update formula
run: |
sed -i "s|url .*|url \"https://registry.npmjs.org/@devcycle/cli/-/cli-${{ steps.npm_data.outputs.latest_version }}.tgz\"|" Formula/Devcycle.rb
sed -i "s|sha256 .*|sha256 \"${{ steps.npm_data.outputs.sha }}\"|" Formula/Devcycle.rb
- name: Commit
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
git add -A
git commit -m "Update to version ${{ steps.npm_data.outputs.latest_version }}"
- name: Push
run: |
git push origin HEAD:main