feat: test GHA build caching

This commit is contained in:
Eli Bosley
2023-08-31 10:52:46 -04:00
parent 4ea00ed3ad
commit 7d9704af5e

View File

@@ -36,7 +36,8 @@ jobs:
id: tag
run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
image_tag="unraid/api-builder:$git_hash"
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
image_tag="unraid/api-builder:$branch"
echo $image_tag
echo "tag=$image_tag" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@v1
@@ -50,6 +51,16 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
- name: Build
uses: docker/build-push-action@v4
with:
context: api
target: builder
push: false
tags: unraid-api:builder
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
lint-api:
needs: [build]
@@ -59,14 +70,21 @@ jobs:
working-directory: api
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
- name: Checkout repo
uses: actions/checkout@v3
with:
name: builder
path: /tmp
- name: Load image
run: |
docker load --input /tmp/builder.tar
persist-credentials: true
- uses: docker/setup-buildx-action@v1
- name: Build and push
uses: docker/build-push-action@v4
with:
context: api
target: builder
push: false
tags: unraid-api:builder
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
- name: Lint
run: |
docker run unraid-api:builder npm run lint