feat: cache for qrcode #23
Workflow file for this run
This file contains 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: Docker Release | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
jobs: | |
prepare-go-components: | |
name: Prepare Go Components | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.get-components.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get Components | |
id: get-components | |
shell: bash | |
run: | | |
COMPONENTS=$(ls components) | |
JSON_STRING='{"components":[' | |
for component in $COMPONENTS; do | |
JSON_STRING="${JSON_STRING}\"${component}\"," | |
done | |
JSON_STRING="${JSON_STRING%?}]}" | |
echo "matrix=${JSON_STRING}" >> $GITHUB_OUTPUT | |
go-build: | |
name: Build Go Components | |
runs-on: ubuntu-latest | |
needs: | |
- prepare-go-components | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.prepare-go-components.outputs.matrix) }} | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
packages: 'write' | |
env: | |
REGISTRY: ghcr.io | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }}-${{ matrix.components }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: docker/basic/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: COMPONENT=${{ matrix.components }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
prepare-rust-components: | |
name: Prepare Rust Components | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.get-components.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get Components | |
id: get-components | |
shell: bash | |
run: | | |
COMPONENTS=$(ls rust-components) | |
JSON_STRING='{"components":[' | |
for component in $COMPONENTS; do | |
JSON_STRING="${JSON_STRING}\"${component}\"," | |
done | |
JSON_STRING="${JSON_STRING%?}]}" | |
echo "matrix=${JSON_STRING}" >> $GITHUB_OUTPUT | |
rust-build: | |
name: Build Rust Components | |
runs-on: ubuntu-latest | |
needs: | |
- prepare-rust-components | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.prepare-rust-components.outputs.matrix) }} | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
packages: 'write' | |
env: | |
REGISTRY: ghcr.io | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }}-${{ matrix.components }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: docker/rust-basic/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: COMPONENT=${{ matrix.components }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |