Skip to content

Commit 06bc352

Browse files
committed
Add GitHub action to build commits to main
Signed-off-by: Nicko Guyer <[email protected]>
1 parent f12c6ef commit 06bc352

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/docker_main.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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

0 commit comments

Comments
 (0)