mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
* Import Full Stack Asset Transfer Guide at commit fb554befdbbeff9e69159b54fce0b811603f29c7 Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Update the workshop with a new WORKSHOP_PATH under fabric-samples Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Update the workshop with a new WORKSHOP_PATH under fabric-samples Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * missed a .git ignored directory on add Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Updates to run the workshop on the Apple M1 Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Workaround for https://github.com/eslint/eslint/issues/15299 in the contract tslinter Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Build an arch-specific CC images on M1 Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * empty commit - force a build Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * revert an accidental commit that was building the top-level asset-transfer as arm64 Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
78 lines
No EOL
3.1 KiB
YAML
78 lines
No EOL
3.1 KiB
YAML
name: Docker CI
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
imagename:
|
|
description: 'A Docker image name passed from the caller workflow'
|
|
required: true
|
|
type: string
|
|
path:
|
|
description: 'A path containing a Dockerfile passed from the caller workflow'
|
|
required: true
|
|
type: string
|
|
chaincode-label:
|
|
description: 'An optional chaincode package label passed from the caller workflow. If present, will prepare a chaincode package.'
|
|
required: false
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
image_digest: ${{ steps.publish_image.outputs.image_digest }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build ${DOCKER_BUILD_PATH} --file ${DOCKER_BUILD_PATH}/Dockerfile --label "org.opencontainers.image.revision=${GITHUB_SHA}" --tag ${IMAGE_NAME}
|
|
docker tag ${IMAGE_NAME} ghcr.io/hyperledgendary/${IMAGE_NAME}:${GITHUB_SHA}
|
|
if [ "${GITHUB_REF:0:10}" = "refs/tags/" ]; then
|
|
docker tag ${IMAGE_NAME} ghcr.io/hyperledgendary/${IMAGE_NAME}:${GITHUB_REF_NAME}
|
|
docker tag ${IMAGE_NAME} ghcr.io/hyperledgendary/${IMAGE_NAME}:latest
|
|
fi
|
|
env:
|
|
DOCKER_BUILD_PATH: ${{ inputs.path }}
|
|
IMAGE_NAME: ${{ inputs.imagename }}
|
|
- name: Publish Docker image
|
|
id: publish_image
|
|
if: github.event_name != 'pull_request'
|
|
run: |
|
|
echo ${DOCKER_PW} | docker login ghcr.io -u ${DOCKER_USER} --password-stdin
|
|
docker push ghcr.io/hyperledgendary/${IMAGE_NAME}:${GITHUB_SHA}
|
|
if [ "${GITHUB_REF:0:10}" = "refs/tags/" ]; then
|
|
docker push ghcr.io/hyperledgendary/${IMAGE_NAME}:${GITHUB_REF_NAME}
|
|
docker push ghcr.io/hyperledgendary/${IMAGE_NAME}:latest
|
|
fi
|
|
echo ::set-output name=image_digest::$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/hyperledgendary/${IMAGE_NAME}:${GITHUB_SHA} | cut -d'@' -f2)
|
|
env:
|
|
IMAGE_NAME: ${{ inputs.imagename }}
|
|
DOCKER_USER: ${{ github.actor }}
|
|
DOCKER_PW: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
package:
|
|
if: inputs.chaincode-label != '' && needs.build.outputs.image_digest != ''
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Create package
|
|
uses: hyperledgendary/package-k8s-chaincode-action@ba10aea43e3d4f7991116527faf96e3c2b07abc7
|
|
with:
|
|
chaincode-label: ${{ inputs.chaincode-label }}
|
|
chaincode-image: ghcr.io/hyperledgendary/${{ inputs.imagename }}
|
|
chaincode-digest: ${{ needs.build.outputs.image_digest }}
|
|
|
|
- name: Rename package
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
run: mv ${{ inputs.chaincode-label }}.tgz ${{ inputs.chaincode-label }}-${CHAINCODE_VERSION}.tgz
|
|
env:
|
|
IMAGE_NAME: ${{ inputs.imagename }}
|
|
CHAINCODE_VERSION: ${{ github.ref_name }}
|
|
|
|
- name: Release package
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: ${{ inputs.chaincode-label }}-${{ github.ref_name }}.tgz |