Skip to content

Commit 15ccd61

Browse files
Merge pull request #74 from kaleido-io/update-github-actions
Update GitHub Actions and enable multi-arch builds
2 parents eb384c4 + 2d142c5 commit 15ccd61

File tree

3 files changed

+105
-56
lines changed

3 files changed

+105
-56
lines changed

.github/workflows/docker_main.yml

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,48 @@ jobs:
99
docker:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v2
18+
19+
- name: Set up Docker Buildx
20+
id: buildx
21+
uses: docker/setup-buildx-action@v2
22+
23+
- name: Docker login
24+
uses: docker/login-action@v1
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
1329

1430
- name: Set build tag
1531
id: build_tag_generator
1632
run: |
17-
RELEASE_TAG=$(curl https://api.github.com/repos/hyperledger/firefly-dataexchange-https/releases/latest -s | jq .tag_name -r)
33+
RELEASE_TAG=$(curl https://api.github.com/repos/${{ github.repository }}/releases/latest -s | jq .tag_name -r)
1834
BUILD_TAG=$RELEASE_TAG-$(date +"%Y%m%d")-$GITHUB_RUN_NUMBER
19-
echo ::set-output name=BUILD_TAG::$BUILD_TAG
35+
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
36+
echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_OUTPUT
37+
echo "name=BUILD_DATE=$BUILD_DATE" >> $GITHUB_OUTPUT
2038
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
39+
- name: Build and push
40+
uses: docker/build-push-action@v4
41+
with:
42+
context: ./
43+
file: ./Dockerfile
44+
builder: ${{ steps.buildx.outputs.name }}
45+
push: true
46+
platforms: linux/amd64,linux/arm64
47+
tags: ghcr.io/${{ github.repository }}:${{ steps.build_tag_generator.outputs.BUILD_TAG }},ghcr.io/${{ github.repository }}:head
48+
labels: |
49+
commit=${{ github.sha }}
50+
build_date=${{ steps.build_tag_generator.outputs.BUILD_DATE }}
51+
tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }}
52+
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
53+
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max
54+
build-args: |
55+
BUILD_VERSION=${{ steps.build_tag_generator.outputs.BUILD_TAG }}
56+
GIT_REF=${{ github.ref }}

.github/workflows/docker_release.yml

Lines changed: 57 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,69 @@ jobs:
88
docker:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v3
1212
with:
1313
fetch-depth: 0
1414

15-
- name: Build
16-
run: |
17-
docker build \
18-
--label commit=$GITHUB_SHA \
19-
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
20-
--label tag=${GITHUB_REF##*/} \
21-
--tag ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/} \
22-
--tag ghcr.io/hyperledger/firefly-dataexchange-https:head \
23-
.
24-
25-
- name: Tag release
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v2
17+
18+
- name: Set up Docker Buildx
19+
id: buildx
20+
uses: docker/setup-buildx-action@v2
21+
22+
- name: Docker login
23+
uses: docker/login-action@v1
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Set latest tag
2630
if: github.event.action == 'released'
27-
run: docker tag ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/} ghcr.io/hyperledger/firefly-dataexchange-https:latest
31+
run: |
32+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository }}:latest" >> $GITHUB_ENV
2833
29-
- name: Push docker image
34+
- name: Set alpha tag
35+
if: github.event.action == 'prereleased' && contains(github.ref, 'alpha')
3036
run: |
31-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
32-
docker push ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/}
33-
34-
- name: Push head tag
37+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository }}:alpha" >> $GITHUB_ENV
38+
39+
- name: Set beta tag
40+
if: github.event.action == 'prereleased' && contains(github.ref, 'beta')
3541
run: |
36-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
37-
docker push ghcr.io/hyperledger/firefly-dataexchange-https:head
42+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository }}:beta" >> $GITHUB_ENV
3843
39-
- name: Push latest tag
40-
if: github.event.action == 'released'
44+
- name: Set rc tag
45+
if: github.event.action == 'prereleased' && contains(github.ref, 'rc')
46+
run: |
47+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository }}:rc" >> $GITHUB_ENV
48+
49+
- name: Set build tag
50+
id: build_tag_generator
4151
run: |
42-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
43-
docker push ghcr.io/hyperledger/firefly-dataexchange-https:latest
52+
RELEASE_TAG=$(curl https://api.github.com/repos/${{ github.repository }}/releases/latest -s | jq .tag_name -r)
53+
BUILD_TAG=$RELEASE_TAG-$(date +"%Y%m%d")-$GITHUB_RUN_NUMBER
54+
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
55+
echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_OUTPUT
56+
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_OUTPUT
57+
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_OUTPUT
58+
59+
- name: Build and push
60+
uses: docker/build-push-action@v4
61+
with:
62+
context: ./
63+
file: ./Dockerfile
64+
builder: ${{ steps.buildx.outputs.name }}
65+
push: true
66+
platforms: linux/amd64,linux/arm64
67+
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }},ghcr.io/${{ github.repository }}:head,${{ env.DOCKER_TAGS }}
68+
labels: |
69+
commit=${{ github.sha }}
70+
build_date=${{ steps.build_tag_generator.outputs.BUILD_DATE }}
71+
tag=${{ steps.build_tag_generator.outputs.RELEASE_TAG }}
72+
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
73+
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max
74+
build-args: |
75+
BUILD_VERSION=${{ steps.build_tag_generator.outputs.RELEASE_TAG }}
76+
GIT_REF=${{ github.ref }}

.github/workflows/tsc.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
name: tsc
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v1
16-
- name: install node v16
17-
uses: actions/setup-node@v1
18-
with:
19-
node-version: 16
20-
- name: npm install
21-
run: npm install
22-
- name: tsc
23-
run: npm t
15+
- uses: actions/checkout@v3
16+
- name: install node v16
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 16
20+
- name: npm install
21+
run: npm install
22+
- name: tsc
23+
run: npm t

0 commit comments

Comments
 (0)