-
Notifications
You must be signed in to change notification settings - Fork 60
71 lines (64 loc) · 2.92 KB
/
update.yaml
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
name: Update Version
permissions:
contents: write
on:
workflow_dispatch:
schedule:
- cron: "0 2 * * *" # Every day at 2AM
jobs:
update-versions:
name: Update versions.json
runs-on: ubuntu-latest
steps:
- uses: nixbuild/nix-quick-install-action@v22
- name: Get Latest Release
uses: octokit/[email protected]
id: get_latest_release
with:
route: GET /repos/{owner}/{repo}/releases/latest
owner: Exafunction
repo: codeium
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- name: Update files
id: update
run: |
VERSION=${{ fromJSON(steps.get_latest_release.outputs.data).tag_name }}
VERSION=${VERSION#language-server-v}
curl -L "https://github.com/Exafunction/codeium/releases/download/language-server-v$VERSION/language_server_linux_x64" \
-o ./language_server
chmod +x ./language_server
STAMP=$(./language_server --stamp | sed -nr 's/STABLE_BUILD_SCM_REVISION: ([0-9a-fA-F]*)/\1/p')
LINUX_X64=$(nix-prefetch-url --type sha256 "https://github.com/Exafunction/codeium/releases/download/language-server-v$VERSION/language_server_linux_x64")
LINUX_ARM=$(nix-prefetch-url --type sha256 "https://github.com/Exafunction/codeium/releases/download/language-server-v$VERSION/language_server_linux_arm")
MACOS_X64=$(nix-prefetch-url --type sha256 "https://github.com/Exafunction/codeium/releases/download/language-server-v$VERSION/language_server_macos_x64")
MACOS_ARM=$(nix-prefetch-url --type sha256 "https://github.com/Exafunction/codeium/releases/download/language-server-v$VERSION/language_server_macos_arm")
jq \
--arg "VERSION" "$VERSION" --arg "STAMP" "$STAMP" \
--arg "LINUX_X64" "$LINUX_X64" --arg "LINUX_ARM" "$LINUX_ARM" \
--arg "MACOS_X64" "$MACOS_X64" --arg "MACOS_ARM" "$MACOS_ARM" \
'{
"version": $VERSION,
"stamp": $STAMP,
"hashes": {
"x86_64-linux": $LINUX_X64,
"aarch64-linux": $LINUX_ARM,
"x86_64-darwin": $MACOS_X64,
"aarch64-darwin": $MACOS_ARM
}
}' <<< "{}" | tee lua/codeium/versions.json | jq -C
if git diff --exit-code lua/codeium/versions.json > /dev/null; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Commit and push
if: steps.update.outputs.changed == 'true'
run: |
git add lua/codeium/versions.json
git config --global user.name "codeium.nvim [bot]"
git config --global user.email "[email protected]"
git commit -m "Update Codeium LSP to ${{ steps.update.outputs.version }}"
git push