-
Notifications
You must be signed in to change notification settings - Fork 17
Docker release pipeline #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
787caae
976e0fd
dd8d130
93fa468
a914af7
b4b1604
5777d75
b6a764e
d0c06e4
c8695f7
66d1684
3b04cf3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # Copyright IBM Corp. All Rights Reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| name: Release Fabric-X Committer Docker Image | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" # Trigger on tags like v0.0.1 | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| jobs: | ||
| docker-release: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout source 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: 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 up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Install dev dependencies | ||
| run: scripts/install-dev-dependencies.sh | ||
|
|
||
| - name: Build cross-architecture binaries | ||
| run: make build-arch | ||
|
|
||
| - name: Set image prefix | ||
| run: | | ||
| if [ "$GITHUB_REPOSITORY_OWNER" == "hyperledger" ]; then | ||
| echo "IMAGE_PREFIX=hyperledger" >> $GITHUB_ENV | ||
| else | ||
| echo "IMAGE_PREFIX=${{ secrets.DOCKERHUB_USERNAME }}" >> $GITHUB_ENV | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this part? We would only push images from the main "hyperledger" repository. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It permits for forks to push in their dockerhubs. That was the idea
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to disable this? I prefer not to have this capability in my fork to avoid mistakes. |
||
| fi | ||
|
|
||
| - name: Build and Push Multi-Platform Docker Image for Committer | ||
| uses: docker/build-push-action@v6 | ||
|
anushka159-a marked this conversation as resolved.
|
||
| with: | ||
| context: . | ||
| file: ./docker/images/release/Dockerfile | ||
| platforms: linux/amd64,linux/arm64,linux/s390x | ||
| push: true | ||
| tags: | | ||
| docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer:latest | ||
| docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer:${{ env.VERSION }} | ||
| build-args: | | ||
| BIN=committer | ||
| ARCHBIN_PATH=archbin | ||
| PORTS=4001 2114 9001 2119 5001 2115 6001 2116 7001 2117 | ||
| cache-from: type=registry,ref=docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer:buildcache | ||
| cache-to: type=registry,ref=docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer:buildcache,mode=max | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: missing line break |
||
Uh oh!
There was an error while loading. Please reload this page.