|
7 | 7 | branches: ['*'] |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - check-appbuilders-version: |
11 | | - runs-on: ubuntu-latest |
12 | | - |
13 | | - steps: |
14 | | - - uses: actions/checkout@v4 |
15 | | - |
16 | | - - name: Get AppBuilder Version |
17 | | - run: | |
18 | | - # Get tag from GHCR |
19 | | - TOKEN_JSON=$(curl https://ghcr.io/token\?scope\="repository:sillsdev/app-builders:pull") |
20 | | - TOKEN=$(echo "$TOKEN_JSON" | jq -r ".token") |
21 | | - TAG_DATA=$(curl -H "Authorization: Bearer $TOKEN" https://ghcr.io/v2/sillsdev/app-builders/tags/list) |
22 | | - NUM_TAGS=$(echo "$TAG_DATA" | jq -r '.tags | length') |
23 | | - FROM_GHCR=$(echo "$TAG_DATA" | jq -r ".tags[$(("$NUM_TAGS" - 1))]") |
24 | | - echo "Latest tag of sillsdev/app-builders is: $FROM_GHCR" |
25 | | - # Get version from package.json |
26 | | - FROM_PACKAGE=$(jq -r ".version" "package.json") |
27 | | - echo "Latest version of sillsdev/appbuilder-pwa is: $FROM_PACKAGE" |
28 | | - if [ "$FROM_GHCR" != "$FROM_PACKAGE" ]; then |
29 | | - echo "version in package.json does not match latest version from ghcr" |
30 | | - exit 1 |
31 | | - fi |
32 | | -
|
33 | 10 | setup: |
34 | 11 | runs-on: ubuntu-latest |
35 | 12 |
|
| 13 | + outputs: |
| 14 | + appbuilder_version: ${{ steps.get_version.outputs.appbuilder_version }} |
| 15 | + |
36 | 16 | steps: |
37 | 17 | - uses: actions/checkout@v4 |
38 | 18 |
|
@@ -63,12 +43,24 @@ jobs: |
63 | 43 | path: node_modules |
64 | 44 | key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} |
65 | 45 |
|
| 46 | + - name: Get AppBuilder Version |
| 47 | + id: get_version |
| 48 | + run: | |
| 49 | + # Get tag from GHCR |
| 50 | + TOKEN_JSON=$(curl https://ghcr.io/token\?scope\="repository:sillsdev/app-builders:pull") |
| 51 | + TOKEN=$(echo "$TOKEN_JSON" | jq -r ".token") |
| 52 | + TAG_DATA=$(curl -H "Authorization: Bearer $TOKEN" https://ghcr.io/v2/sillsdev/app-builders/tags/list) |
| 53 | + NUM_TAGS=$(echo "$TAG_DATA" | jq -r '.tags | length') |
| 54 | + FROM_GHCR=$(echo "$TAG_DATA" | jq -r ".tags[$(("$NUM_TAGS" - 1))]") |
| 55 | + echo "Latest tag of sillsdev/app-builders is: $FROM_GHCR" |
| 56 | + echo "appbuilder_version=$FROM_GHCR" >> $GITHUB_OUTPUT |
| 57 | +
|
66 | 58 | - name: Restore Projects cache |
67 | 59 | id: restore-projects-cache |
68 | 60 | uses: actions/cache@v4 |
69 | 61 | with: |
70 | 62 | path: project_data |
71 | | - key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }} |
| 63 | + key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }}-${{ steps.get_version.outputs.appbuilder_version }} |
72 | 64 |
|
73 | 65 | - name: Setup Java |
74 | 66 | if: steps.restore-projects-cache.outputs.cache-hit != 'true' |
@@ -163,7 +155,7 @@ jobs: |
163 | 155 | uses: actions/cache@v4 |
164 | 156 | with: |
165 | 157 | path: project_data |
166 | | - key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }} |
| 158 | + key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }}-${{ needs.setup.outputs.appbuilder_version }} |
167 | 159 |
|
168 | 160 | - name: Convert minimal project |
169 | 161 | run: | |
@@ -203,7 +195,7 @@ jobs: |
203 | 195 | uses: actions/cache@v4 |
204 | 196 | with: |
205 | 197 | path: project_data |
206 | | - key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }} |
| 198 | + key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }}-${{ needs.setup.outputs.appbuilder_version }} |
207 | 199 |
|
208 | 200 | - name: Run Tests |
209 | 201 | run: | |
|
0 commit comments