Refine repository links and descriptions in README (#65) #16
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
| # | |
| # Copyright IBM Corp. All Rights Reserved. | |
| # | |
| # SPDX-License-Identifier: Apache-2.0 | |
| # | |
| name: Build Image | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| packages: write # needed for GHCR (TODO add) | |
| jobs: | |
| image-build: | |
| name: Docker Image Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU for cross-platform builds | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract and Validate Version from Tag | |
| id: extract | |
| run: | | |
| if [[ "${GITHUB_REF}" =~ ^refs/tags/v([0-9]+\.[0-9]+\.[0-9]+.*)$ ]]; then | |
| VERSION="${BASH_REMATCH[1]}" | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "✅ Tag validated: $VERSION" | |
| else | |
| echo "❌ Invalid tag format: ${GITHUB_REF}. Expected format: refs/tags/v<semver>" | |
| exit 1 | |
| fi | |
| - name: Set image build prefix and metadata | |
| run: | | |
| echo "CREATED=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV | |
| echo "REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
| if [ "$GITHUB_REPOSITORY_OWNER" == "hyperledger" ]; then | |
| echo "IMAGE_PREFIX=hyperledger" >> $GITHUB_ENV | |
| else | |
| echo "IMAGE_PREFIX=${{ secrets.DOCKERHUB_USERNAME }}" >> $GITHUB_ENV | |
| fi | |
| - name: Build and push the fabric-x-tools image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64,linux/arm64,linux/s390x | |
| push: true | |
| build-args: | | |
| VERSION=${{ env.VERSION }} | |
| CREATED=${{ env.CREATED }} | |
| REVISION=${{ env.REVISION }} | |
| tags: | | |
| docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-tools:${{ env.VERSION }} | |
| docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-tools:latest | |
| ghcr.io/${{ env.IMAGE_PREFIX }}/fabric-x-tools:${{ env.VERSION }} | |
| ghcr.io/${{ env.IMAGE_PREFIX }}/fabric-x-tools:latest |