Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 39 additions & 19 deletions .github/workflows/docker_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,54 @@ jobs:
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Set up qemu emulators
run: |
docker run --rm --privileged tonistiigi/binfmt --install all

- name: Docker login
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set build tag
id: build_tag_generator
run: |
RELEASE_TAG=$(curl https://api.github.com/repos/hyperledger/firefly/releases/latest -s | jq .tag_name -r)
RELEASE_TAG=$(curl https://api.github.com/repos/${{ github.repository_owner }}/firefly/releases/latest -s | jq .tag_name -r)
BUILD_TAG=$RELEASE_TAG-$(date +"%Y%m%d")-$GITHUB_RUN_NUMBER
echo ::set-output name=BUILD_TAG::$BUILD_TAG

- name: Build

- name: Read manifest.json
id: manifest
run: |
make DOCKER_ARGS="\
--build-arg BUILD_VERSION=${{ steps.build_tag_generator.outputs.BUILD_TAG }} \
--build-arg GIT_REF=$GITHUB_SHA \
--label commit=$GITHUB_SHA \
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }} \
--tag ghcr.io/hyperledger/firefly:${{ steps.build_tag_generator.outputs.BUILD_TAG }} \
--tag ghcr.io/hyperledger/firefly:head \
--push" \
docker-multiarch
echo ::set-output name=FIREFLY_BUILDER_TAG::$(cat manifest.json | jq -r '.build."firefly-builder".image')
echo ::set-output name=FABRIC_BUILDER_TAG::$(cat manifest.json | jq -r '.build."fabric-builder".image')
echo ::set-output name=FABRIC_BUILDER_PLATFORM::$(cat manifest.json | jq -r '.build."fabric-builder".platform')
echo ::set-output name=SOLIDITY_BUILDER_TAG::$(cat manifest.json | jq -r '.build."solidity-builder".image')
echo ::set-output name=BASE_TAG::$(cat manifest.json | jq -r '.build.base.image')
echo ::set-output name=UI_TAG::$(cat manifest.json | jq -r '.ui.tag')
echo ::set-output name=UI_RELEASE::$(cat manifest.json | jq -r '.ui.release')

- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ghcr.io/${{ github.repository_owner }}/firefly:${{ steps.build_tag_generator.outputs.BUILD_TAG }},ghcr.io/${{ github.repository_owner }}/firefly:head
labels: commit=$GITHUB_SHA, build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ"), tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/firefly:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/firefly:buildcache,mode=max
build-args: |
FIREFLY_BUILDER_TAG=${{ steps.manifest.outputs.FIREFLY_BUILDER_TAG }}
FABRIC_BUILDER_TAG=${{ steps.manifest.outputs.FABRIC_BUILDER_TAG }}
FABRIC_BUILDER_PLATFORM=${{ steps.manifest.outputs.FABRIC_BUILDER_PLATFORM }}
SOLIDITY_BUILDER_TAG=${{ steps.manifest.outputs.SOLIDITY_BUILDER_TAG }}
BASE_TAG=${{ steps.manifest.outputs.BASE_TAG }}
UI_TAG=${{ steps.manifest.outputs.UI_TAG }}
UI_RELEASE=${{ steps.manifest.outputs.UI_RELEASE }}
63 changes: 43 additions & 20 deletions .github/workflows/docker_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,67 @@ jobs:
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Set up qemu emulators
run: |
docker run --rm --privileged tonistiigi/binfmt --install all

- name: Docker login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set latest tag
if: github.event.action == 'released'
run: |
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }} --tag ghcr.io/hyperledger/firefly:latest" >> $GITHUB_ENV
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository_owner }}/firefly:latest" >> $GITHUB_ENV

- name: Set alpha tag
if: github.event.action == 'prereleased' && contains(github.ref, 'alpha')
run: |
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }} --tag ghcr.io/hyperledger/firefly:alpha" >> $GITHUB_ENV
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository_owner }}/firefly:alpha" >> $GITHUB_ENV

- name: Set beta tag
if: github.event.action == 'prereleased' && contains(github.ref, 'beta')
run: |
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }} --tag ghcr.io/hyperledger/firefly:beta" >> $GITHUB_ENV
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository_owner }}/firefly:beta" >> $GITHUB_ENV

- name: Set rc tag
if: github.event.action == 'prereleased' && contains(github.ref, 'rc')
run: |
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }} --tag ghcr.io/hyperledger/firefly:rc" >> $GITHUB_ENV
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository_owner }}/firefly:rc" >> $GITHUB_ENV

- name: Build
- name: Read manifest.json
id: manifest
run: |
make DOCKER_ARGS="\
--build-arg BUILD_VERSION=${GITHUB_REF##*/} \
--build-arg GIT_REF=$GITHUB_SHA \
--label commit=$GITHUB_SHA \
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label tag=${GITHUB_REF##*/} \
--tag ghcr.io/hyperledger/firefly:${GITHUB_REF##*/} \
--tag ghcr.io/hyperledger/firefly:head \
${{ env.DOCKER_TAGS }} \
--push" \
docker-multiarch
echo ::set-output name=FIREFLY_BUILDER_TAG::$(cat manifest.json | jq -r '.build."firefly-builder".image')
echo ::set-output name=FABRIC_BUILDER_TAG::$(cat manifest.json | jq -r '.build."fabric-builder".image')
echo ::set-output name=FABRIC_BUILDER_PLATFORM::$(cat manifest.json | jq -r '.build."fabric-builder".platform')
echo ::set-output name=SOLIDITY_BUILDER_TAG::$(cat manifest.json | jq -r '.build."solidity-builder".image')
echo ::set-output name=BASE_TAG::$(cat manifest.json | jq -r '.build.base.image')
echo ::set-output name=UI_TAG::$(cat manifest.json | jq -r '.ui.tag')
echo ::set-output name=UI_RELEASE::$(cat manifest.json | jq -r '.ui.release')

- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ghcr.io/${{ github.repository_owner }}/firefly:${{ github.ref_name }},ghcr.io/${{ github.repository_owner }}/firefly:head,${{ env.DOCKER_TAGS }}
labels: commit=$GITHUB_SHA, build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ"), tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/firefly:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/firefly:buildcache,mode=max
build-args: |
FIREFLY_BUILDER_TAG=${{ steps.manifest.outputs.FIREFLY_BUILDER_TAG }}
FABRIC_BUILDER_TAG=${{ steps.manifest.outputs.FABRIC_BUILDER_TAG }}
FABRIC_BUILDER_PLATFORM=${{ steps.manifest.outputs.FABRIC_BUILDER_PLATFORM }}
SOLIDITY_BUILDER_TAG=${{ steps.manifest.outputs.SOLIDITY_BUILDER_TAG }}
BASE_TAG=${{ steps.manifest.outputs.BASE_TAG }}
UI_TAG=${{ steps.manifest.outputs.UI_TAG }}
UI_RELEASE=${{ steps.manifest.outputs.UI_RELEASE }}