-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (64 loc) · 2.14 KB
/
trigger.yml
File metadata and controls
73 lines (64 loc) · 2.14 KB
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
name: Trigger
on:
schedule:
- cron: '0 0 * * *' # daily check
workflow_dispatch: # manual trigger
permissions:
contents: write
packages: write
jobs:
check:
runs-on: ubuntu-latest
outputs:
trigger: ${{ steps.set-output.outputs.trigger }}
release: ${{ steps.release.outputs.latest }}
steps:
- name: Checkout vcpkg-json repo
uses: actions/checkout@v4
with:
repository: maxtek6/WebFrame
path: WebFrame
- name: Compute hash of vcpkg.json
id: hash
run: |
HASH=$(sha256sum WebFrame/vcpkg.json | awk '{print $1}')
echo "hash=$HASH" >> $GITHUB_OUTPUT
- name: Get latest vcpkg release
id: release
run: |
LATEST=$(curl -s https://api.github.com/repos/microsoft/vcpkg/releases/latest | jq -r '.tag_name')
echo "latest=$LATEST" >> $GITHUB_OUTPUT
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
path: .cache
key: vcpkg-trigger-cache
- name: Determine if trigger is needed
id: set-output
run: |
LAST_HASH=$(cat .cache/last_hash.txt || echo "")
LAST_RELEASE=$(cat .cache/last_release.txt || echo "")
echo "LAST_HASH=$LAST_HASH"
echo "LAST_RELEASE=$LAST_RELEASE"
if [[ "$LAST_HASH" == "${{ steps.hash.outputs.hash }}" && "$LAST_RELEASE" == "${{ steps.release.outputs.latest }}" ]]; then
echo "No changes, skip processing pipeline"
echo "trigger=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
mkdir -p .cache
echo "${{ steps.hash.outputs.hash }}" > .cache/last_hash.txt
echo "${{ steps.release.outputs.latest }}" > .cache/last_release.txt
echo "trigger=true" >> $GITHUB_OUTPUT
fi
- name: Upload cache
uses: actions/cache@v4
with:
path: .cache
key: vcpkg-trigger-cache
build:
needs: check
if: needs.check.outputs.trigger == 'true'
uses: ./.github/workflows/build.yml
with:
release: ${{ needs.check.outputs.release }}