File tree Expand file tree Collapse file tree 2 files changed +43
-3
lines changed
Expand file tree Collapse file tree 2 files changed +43
-3
lines changed Original file line number Diff line number Diff line change 1+ name : Docker Main Build
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ docker :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v2
13+
14+ - name : Set build tag
15+ id : build_tag_generator
16+ run : |
17+ RELEASE_TAG=$(curl https://api.github.com/repos/hyperledger/firefly-dataexchange-https/releases/latest -s | jq .tag_name -r)
18+ BUILD_TAG=$RELEASE_TAG-$(date +"%Y%m%d")-$GITHUB_RUN_NUMBER
19+ echo ::set-output name=BUILD_TAG::$BUILD_TAG
20+
21+ - name : Build
22+ run : |
23+ docker build \
24+ --label commit=$GITHUB_SHA \
25+ --label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
26+ --label tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }} \
27+ --tag ghcr.io/hyperledger/firefly-dataexchange-https:${{ steps.build_tag_generator.outputs.BUILD_TAG }} .
28+
29+ - name : Tag release
30+ run : docker tag ghcr.io/hyperledger/firefly-dataexchange-https:${{ steps.build_tag_generator.outputs.BUILD_TAG }} ghcr.io/hyperledger/firefly-dataexchange-https:head
31+
32+ - name : Push docker image
33+ run : |
34+ echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
35+ docker push ghcr.io/hyperledger/firefly-dataexchange-https:${{ steps.build_tag_generator.outputs.BUILD_TAG }}
36+
37+ - name : Push head tag
38+ run : |
39+ echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
40+ docker push ghcr.io/hyperledger/firefly-dataexchange-https:head
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: Docker
22
33on :
44 release :
5- types : [published , prereleased]
5+ types : [released , prereleased]
66
77jobs :
88 docker :
1414 run : docker build -t ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/} .
1515
1616 - name : Tag release
17- if : github.event.action == 'published '
17+ if : github.event.action == 'released '
1818 run : docker tag ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/} ghcr.io/hyperledger/firefly-dataexchange-https:latest
1919
2020 - name : Push docker image
2323 docker push ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/}
2424
2525 - name : Push latest tag
26- if : github.event.action == 'published '
26+ if : github.event.action == 'released '
2727 run : |
2828 echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
2929 docker push ghcr.io/hyperledger/firefly-dataexchange-https:latest
You can’t perform that action at this time.
0 commit comments