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
40 changes: 40 additions & 0 deletions .github/workflows/docker_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Docker Main Build

on:
push:
branches:
- main

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set build tag
id: build_tag_generator
run: |
RELEASE_TAG=$(curl https://api.github.com/repos/hyperledger/firefly-dataexchange-https/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
run: |
docker build \
--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-dataexchange-https:${{ steps.build_tag_generator.outputs.BUILD_TAG }} .

- name: Tag release
run: docker tag ghcr.io/hyperledger/firefly-dataexchange-https:${{ steps.build_tag_generator.outputs.BUILD_TAG }} ghcr.io/hyperledger/firefly-dataexchange-https:head

- name: Push docker image
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/hyperledger/firefly-dataexchange-https:${{ steps.build_tag_generator.outputs.BUILD_TAG }}

- name: Push head tag
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/hyperledger/firefly-dataexchange-https:head
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Docker

on:
release:
types: [published, prereleased]
types: [released, prereleased]

jobs:
docker:
Expand All @@ -14,7 +14,7 @@ jobs:
run: docker build -t ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/} .

- name: Tag release
if: github.event.action == 'published'
if: github.event.action == 'released'
run: docker tag ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/} ghcr.io/hyperledger/firefly-dataexchange-https:latest

- name: Push docker image
Expand All @@ -23,7 +23,7 @@ jobs:
docker push ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/}

- name: Push latest tag
if: github.event.action == 'published'
if: github.event.action == 'released'
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/hyperledger/firefly-dataexchange-https:latest