fix Makfile for public repo #20
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: client-components | |
| permissions: | |
| contents: read | |
| packages: write | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| branches: | |
| - b-* | |
| - main | |
| - dev | |
| jobs: | |
| build: | |
| name: build-${{ matrix.component }}-${{ matrix.arch }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| component: [cordium] | |
| arch: | |
| - amd64 | |
| - arm64 | |
| include: | |
| - arch: amd64 | |
| platform: linux/amd64 | |
| runner: ubuntu-24.04 | |
| - arch: arm64 | |
| platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v4 | |
| - name: Inject slug/short variables | |
| uses: rlespinasse/github-slug-action@v4 | |
| - name: Set ENV variables | |
| env: | |
| ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
| run: for v in `cat .github/workflows/env` ; do echo "::set-env name=${v%%=*}::${v##*=}" ; done | |
| - name: Set is latest | |
| run: | | |
| IS_LATEST=$(git tag | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$" | sort -r --version-sort | head -n1) | |
| echo $IS_LATEST | |
| if [ "$IS_LATEST" = ${{ env.GITHUB_REF_SLUG }} ]; then | |
| echo "V_IS_LATEST=true" >> $GITHUB_ENV | |
| else | |
| echo "V_IS_LATEST=false" >> $GITHUB_ENV | |
| fi | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: ${{env.V_CONTAINER_REGISTRY}}/${{env.V_ORG}}/${{matrix.component}} | |
| flavor: | | |
| latest=false | |
| prefix= | |
| suffix=-${{ matrix.arch }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Github Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{env.V_CONTAINER_REGISTRY}} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: client/${{matrix.component}}/Dockerfile | |
| platforms: ${{ matrix.platform }} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| provenance: false | |
| create-manifest: | |
| name: Create manifest for ${{ matrix.component }} | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| component: [cordium] | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Inject slug/short variables | |
| uses: rlespinasse/github-slug-action@v4 | |
| - name: Set ENV variables | |
| env: | |
| ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
| run: for v in `cat .github/workflows/env` ; do echo "::set-env name=${v%%=*}::${v##*=}" ; done | |
| - name: Set is latest | |
| run: | | |
| IS_LATEST=$(git tag | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$" | sort -r --version-sort | head -n1) | |
| echo $IS_LATEST | |
| if [ "$IS_LATEST" = ${{ env.GITHUB_REF_SLUG }} ]; then | |
| echo "V_IS_LATEST=true" >> $GITHUB_ENV | |
| else | |
| echo "V_IS_LATEST=false" >> $GITHUB_ENV | |
| fi | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: ${{env.V_CONTAINER_REGISTRY}}/${{env.V_ORG}}/${{matrix.component}} | |
| flavor: | | |
| latest=${{env.V_IS_LATEST}} | |
| prefix= | |
| suffix= | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{env.V_CONTAINER_REGISTRY}} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create and push manifest with annotations | |
| env: | |
| LABELS: ${{ steps.meta.outputs.labels }} | |
| BASE_IMAGE: ${{env.V_CONTAINER_REGISTRY}}/${{env.V_ORG}}/${{matrix.component}} | |
| VERSION: ${{ steps.meta.outputs.version }} | |
| run: | | |
| TAGS="${{ steps.meta.outputs.tags }}" | |
| ANNOTATIONS=() | |
| while IFS='=' read -r key value; do | |
| if [ -n "$key" ] && [ -n "$value" ]; then | |
| ANNOTATIONS+=("--annotation" "index:${key}=${value}") | |
| fi | |
| done <<< "$LABELS" | |
| for TAG in $TAGS; do | |
| echo "Creating manifest for $TAG" | |
| docker buildx imagetools create \ | |
| "${ANNOTATIONS[@]}" \ | |
| -t "$TAG" \ | |
| "${BASE_IMAGE}:${VERSION}-amd64" \ | |
| "${BASE_IMAGE}:${VERSION}-arm64" | |
| done |