Skip to content

Commit 23caba3

Browse files
committed
deploy release artifacts on a schedule instead of on each commit
1 parent 5907818 commit 23caba3

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

.github/workflows/artifacts.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Deploy release artifacts
22

33
on:
4-
push:
5-
branches:
6-
- master
4+
schedule:
5+
- cron: "0 0 * * *"
76
workflow_dispatch:
87
# When manually invocing this workflow, keep in mind that ZLS builds can't be modified after they have been published to `releases.zigtools.org/v1/zls/publish`.
98

@@ -16,6 +15,21 @@ jobs:
1615
with:
1716
fetch-depth: 0 # required to resolve the version string
1817

18+
- name: Skip if no new commits
19+
run: |
20+
LAST_SUCCESS_COMMIT=$(curl -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/zigtools/zls/actions/runs?branch=master&status=success&per_page=1" | jq --raw-output ".workflow_runs[0].head_sha")
21+
CURRENT_COMMIT=$(git rev-parse HEAD)
22+
23+
echo "Latest commit with successfull CI: $LAST_SUCCESS_COMMIT"
24+
echo "Current commit: $CURRENT_COMMIT"
25+
26+
if [ $LAST_SUCCESS_COMMIT = $CURRENT_COMMIT ]; then
27+
echo "skipped=yes" >> $GITHUB_OUTPUT
28+
echo "Commits are equal, skipping."
29+
fi
30+
env:
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
1933
- uses: mlugg/setup-zig@v2
2034
with:
2135
version: master

0 commit comments

Comments
 (0)