Skip to content

Commit 85c3dc1

Browse files
committed
Use AppBuilders Version in key for project_data cache
Try container id? Try tags API? Full check? Move check to main.yml Put latest version of PWA in package.json Apparently I needed to format the yml.... Include appbuilder version in project cache key Fix cache key Revert "Put latest version of PWA in package.json"
1 parent 40a6310 commit 85c3dc1

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

.github/workflows/main.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010
setup:
1111
runs-on: ubuntu-latest
1212

13+
outputs:
14+
appbuilder_version: ${{ steps.get_version.outputs.appbuilder_version }}
15+
1316
steps:
1417
- uses: actions/checkout@v4
1518

@@ -40,12 +43,24 @@ jobs:
4043
path: node_modules
4144
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
4245

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+
4358
- name: Restore Projects cache
4459
id: restore-projects-cache
4560
uses: actions/cache@v4
4661
with:
4762
path: project_data
48-
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 }}
4964

5065
- name: Setup Java
5166
if: steps.restore-projects-cache.outputs.cache-hit != 'true'
@@ -118,7 +133,7 @@ jobs:
118133
uses: actions/cache@v4
119134
with:
120135
path: project_data
121-
key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }}
136+
key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }}-${{ steps.get_version.outputs.appbuilder_version }}
122137

123138
lint:
124139
runs-on: ubuntu-latest
@@ -140,7 +155,7 @@ jobs:
140155
uses: actions/cache@v4
141156
with:
142157
path: project_data
143-
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 }}
144159

145160
- name: Convert minimal project
146161
run: |
@@ -180,7 +195,7 @@ jobs:
180195
uses: actions/cache@v4
181196
with:
182197
path: project_data
183-
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 }}
184199

185200
- name: Run Tests
186201
run: |

0 commit comments

Comments
 (0)