-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (70 loc) · 2.47 KB
/
schedule.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: schedule
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
schedule:
- cron: '0 0/8 * * *'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
latest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
channel: [stable, beta, dev]
outputs:
stable-version: ${{ steps.version.outputs.stable-version }}
stable-cache-hit: ${{ steps.cache.outputs.stable-cache-hit }}
beta-version: ${{ steps.version.outputs.beta-version }}
beta-cache-hit: ${{ steps.cache.outputs.beta-cache-hit }}
dev-version: ${{ steps.version.outputs.dev-version }}
dev-cache-hit: ${{ steps.cache.outputs.dev-cache-hit }}
steps:
- name: Get ${{ matrix.channel }} release
run: |
curl -fsSL "https://storage.googleapis.com/dart-archive/channels/${{ matrix.channel }}/release/latest/VERSION" | tee VERSION
- name: Get ${{ matrix.channel }} version
id: version
run: |
echo "${{ matrix.channel }}-version=$(yq .version VERSION)" | tee -a $GITHUB_OUTPUT
- name: Cache
id: cache
run: |
if ${{ github.event.schedule && 'true' || 'false' }} && curl -fsSLo /dev/null "${{ github.server_url }}/${{ github.repository }}/releases/tag/$(yq .version VERSION)"; then
echo "${{ matrix.channel }}-cache-hit=true" | tee -a $GITHUB_OUTPUT
else
echo "${{ matrix.channel }}-cache-hit=false" | tee -a $GITHUB_OUTPUT
fi
stable:
needs: [latest]
if: needs.latest.outputs.stable-cache-hit != 'true'
uses: ./.github/workflows/build.yml
with:
ref: ${{ needs.latest.outputs.stable-version }}
secrets: inherit
beta:
needs: [latest]
if: needs.latest.outputs.beta-cache-hit != 'true' && needs.latest.outputs.beta-version != needs.latest.outputs.stable-version
uses: ./.github/workflows/build.yml
with:
ref: ${{ needs.latest.outputs.beta-version }}
secrets: inherit
dev:
needs: [latest]
if: needs.latest.outputs.dev-cache-hit != 'true' && needs.latest.outputs.dev-version != needs.latest.outputs.beta-version && needs.latest.outputs.dev-version != needs.latest.outputs.stable-version
uses: ./.github/workflows/build.yml
with:
ref: ${{ needs.latest.outputs.dev-version }}
secrets: inherit
main:
needs: [latest]
uses: ./.github/workflows/build.yml
with:
ref: main