Use AppBuilders Version in key for project_data cache #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: WIP | |
| on: | |
| push: | |
| branches: ['*'] | |
| pull_request: | |
| branches: ['*'] | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: volta-cli/action@v4 | |
| - name: Get environment info | |
| run: | | |
| node --version | |
| npm --version | |
| - name: Restore node_modules cache | |
| id: restore-node-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} | |
| - name: Install dependencies | |
| if: steps.restore-node-cache.outputs.cache-hit != 'true' | |
| run: | | |
| echo "Installing dependencies..." | |
| npm ci | |
| - name: Cache node_modules | |
| if: steps.restore-node-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} | |
| - name: Get AppBuilder Version | |
| run: | | |
| # Get tag from GHCR | |
| TOKEN_JSON=$(curl https://ghcr.io/token\?scope\="repository:sillsdev/app-builders:pull") | |
| TOKEN=$(echo "$TOKEN_JSON" | jq -r ".token") | |
| TAG_DATA=$(curl -H "Authorization: Bearer $TOKEN" https://ghcr.io/v2/sillsdev/app-builders/tags/list) | |
| NUM_TAGS=$(echo "$TAG_DATA" | jq -r '.tags | length') | |
| FROM_GHCR=$(echo "$TAG_DATA" | jq -r ".tags[$(("$NUM_TAGS" - 1))]") | |
| echo "Latest tag of sillsdev/app-builders is: $FROM_GHCR" | |
| # Get version from package.json | |
| FROM_PACKAGE=$(jq -r ".version" "package.json") | |
| echo "Latest version of sillsdev/appbuilder-pwa is: $FROM_PACKAGE" | |
| if [ "$FROM_GHCR" != "$FROM_PACKAGE" ]; then | |
| echo "version in package.json does not match latest version from ghcr" | |
| exit 1 | |
| fi | |