Skip to content

Commit

Permalink
Extract lable and tag
Browse files Browse the repository at this point in the history
  • Loading branch information
athackst committed Jan 4, 2025
1 parent d659716 commit 0c576a0
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,40 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v4
- name: Extract Label and Tag
id: extract
run: |
# Extract the full filename (e.g., label/tag.Dockerfile)
filename="${{ matrix.dockerfile }}"
# Extract label (e.g., 'label')
label=$(dirname "$filename")
# Extract tag (e.g., 'tag')
tag=$(basename "$filename" | cut -d. -f1)
echo "Label: $label, Tag: $tag"
# Set outputs for subsequent steps
echo "label=$label" >> $GITHUB_OUTPUT
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Test dockerfile build
if: ${{ matrix.dockerfile != 'none' }}
uses: docker/build-push-action@v6
with:
push: false
file: ${{ matrix.dockerfile }}
tags: |
ghcr.io/${{ github.repository_owner }}/${{ steps.extract.outputs.label }}:${{ steps.extract.outputs.tag }}-linux/amd64
cache-from: |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.label }}:${{ matrix.tag }}-buildcache
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ steps.extract.outputs.label }}:${{ steps.extract.outputs.tag }}-buildcache
type=gha
cache-to:
cache-to:
type=gha,mode=max

complete:
Expand Down

0 comments on commit 0c576a0

Please sign in to comment.