File tree Expand file tree Collapse file tree 2 files changed +73
-2
lines changed Expand file tree Collapse file tree 2 files changed +73
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : " Daily Update and Release"
2
+ on :
3
+ schedule :
4
+ - cron : ' 0 0 * * *' # Run daily at midnight UTC
5
+ workflow_dispatch : # Allow manual triggering
6
+
7
+ jobs :
8
+ update-and-test :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - uses : actions/checkout@v3
12
+
13
+ - name : Set up Nix
14
+ uses : cachix/install-nix-action@v22
15
+
16
+ - name : Install just
17
+ run : |
18
+ nix-env -iA nixpkgs.just
19
+ nix-env -iA nixpkgs.jq
20
+
21
+ - name : Update lsp-bridge.nix and run tests
22
+ id : update_and_test
23
+ run : |
24
+ if ! just test; then
25
+ echo "First test run failed, retrying..."
26
+ if just test; then
27
+ echo "Second test run succeeded"
28
+ echo "test_passed=true" >> $GITHUB_OUTPUT
29
+
30
+ # update the version for release tag
31
+ just update_version
32
+ else
33
+ echo "Second test after re-generation run failed"
34
+ exit 1
35
+ fi
36
+ fi
37
+
38
+ - name : Commit and push changes if any
39
+ if : steps.update_and_test.outputs.test_passed == 'true'
40
+ run : |
41
+ git config --global user.name 'GitHub Actions Bot'
42
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
43
+ git add _generator/ src/ test/
44
+ if git diff --staged --quiet; then
45
+ echo "No changes to commit"
46
+ else
47
+ git commit -m "Update lsp-bridge to latest version"
48
+ git push
49
+ fi
Original file line number Diff line number Diff line change @@ -22,15 +22,37 @@ test: generate
22
22
23
23
if [ -n " $got_value" ]; then
24
24
echo " The 'got:' value is: $got_value"
25
- sed -i " s/ sha256 = .*/ sha256 = $got_value/ " _generator/ src_template/ {{ cookiecutter.langserver}} / lsp-bridge.nix
26
-
25
+ sed -i " s| sha256 = .*| sha256 = $got_value| " _generator/ src_template/ {{ {{cookiecutter.langserver}}/ lsp-bridge.nix
26
+
27
27
echo " Updated lsp-bridge.nix with the new sha256 value."
28
28
echo " Generate and test again."
29
29
exit 1
30
30
else
31
31
echo " Test passed"
32
32
fi
33
33
34
+ # update the version for release tag
35
+ update_version :
36
+ #!/ bin/ bash
37
+ file=" _generator/src_template/{{{{cookiecutter.langserver}}/devcontainer-feature.json"
38
+
39
+ # Read the current version
40
+ current_version=$(jq -r ' .version' " $file" )
41
+
42
+ # Split the version into parts
43
+ IFS=' .' read -ra version_parts <<< " $current_version"
44
+
45
+ # Increment the last part
46
+ ((version_parts[2 ]++ ))
47
+
48
+ # Join the parts back together
49
+ new_version=" ${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
50
+
51
+ # Update the file with the new version
52
+ jq --arg version " $new_version" ' .version = $version' " $file" > temp.json && mv temp.json " $file"
53
+
54
+ echo " Version updated from $current_version to $new_version"
55
+
34
56
# open a devcontainer in VSCode
35
57
devcontainer :
36
58
p=$(printf " %s" " $PWD" | hexdump -v -e ' /1 "%02x"' ) && code --folder-uri " vscode-remote://dev-container+${p}/workspaces/$(basename $PWD)"
You can’t perform that action at this time.
0 commit comments