Skip to content

Commit f23fb8f

Browse files
authored
Merge pull request #24 from hyperledger/github-actions-release
feat: use standard firefly github action config
2 parents e3287f1 + 9b511a7 commit f23fb8f

File tree

15 files changed

+400
-109
lines changed

15 files changed

+400
-109
lines changed

.github/workflows/docker-main.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Docker Main Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
packages: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v3
23+
24+
- name: Set up Docker Buildx
25+
id: buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Docker login
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Set build tag
36+
id: build_tag_generator
37+
run: |
38+
RELEASE_TAG=$(curl https://api.github.com/repos/${{ github.repository }}/releases/latest -s | jq .tag_name -r)
39+
BUILD_TAG=$RELEASE_TAG-$(date +"%Y%m%d")-$GITHUB_RUN_NUMBER
40+
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
41+
echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_OUTPUT
42+
echo "name=BUILD_DATE=$BUILD_DATE" >> $GITHUB_OUTPUT
43+
44+
- name: Build and push
45+
uses: docker/build-push-action@v5
46+
with:
47+
context: ./
48+
file: ./Dockerfile
49+
builder: ${{ steps.buildx.outputs.name }}
50+
push: true
51+
platforms: linux/amd64
52+
provenance: false
53+
tags: ghcr.io/${{ github.repository }}:${{ steps.build_tag_generator.outputs.BUILD_TAG }},ghcr.io/${{ github.repository }}:head
54+
labels: |
55+
commit=${{ github.sha }}
56+
build_date=${{ steps.build_tag_generator.outputs.BUILD_DATE }}
57+
tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }}
58+
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
59+
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max
60+
build-args: |
61+
BUILD_VERSION=${{ steps.build_tag_generator.outputs.BUILD_TAG }}
62+
GIT_REF=${{ github.ref }}

.github/workflows/docker-release.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Docker Release Build
2+
3+
on:
4+
release:
5+
types: [released, prereleased]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
packages: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v3
22+
23+
- name: Set up Docker Buildx
24+
id: buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Docker login
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Set latest tag
35+
if: github.event.action == 'released'
36+
run: |
37+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository }}:latest" >> $GITHUB_ENV
38+
39+
- name: Set alpha tag
40+
if: github.event.action == 'prereleased' && contains(github.ref, 'alpha')
41+
run: |
42+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository }}:alpha" >> $GITHUB_ENV
43+
44+
- name: Set beta tag
45+
if: github.event.action == 'prereleased' && contains(github.ref, 'beta')
46+
run: |
47+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository }}:beta" >> $GITHUB_ENV
48+
49+
- name: Set rc tag
50+
if: github.event.action == 'prereleased' && contains(github.ref, 'rc')
51+
run: |
52+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},ghcr.io/${{ github.repository }}:rc" >> $GITHUB_ENV
53+
54+
- name: Set build tag
55+
id: build_tag_generator
56+
run: |
57+
RELEASE_TAG=$(curl https://api.github.com/repos/${{ github.repository }}/releases/latest -s | jq .tag_name -r)
58+
BUILD_TAG=$RELEASE_TAG-$(date +"%Y%m%d")-$GITHUB_RUN_NUMBER
59+
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
60+
echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_OUTPUT
61+
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_OUTPUT
62+
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_OUTPUT
63+
64+
- name: Build and push
65+
uses: docker/build-push-action@v5
66+
with:
67+
context: ./
68+
file: ./Dockerfile
69+
builder: ${{ steps.buildx.outputs.name }}
70+
push: true
71+
platforms: linux/amd64
72+
provenance: false
73+
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }},ghcr.io/${{ github.repository }}:head,${{ env.DOCKER_TAGS }}
74+
labels: |
75+
commit=${{ github.sha }}
76+
build_date=${{ steps.build_tag_generator.outputs.BUILD_DATE }}
77+
tag=${{ steps.build_tag_generator.outputs.RELEASE_TAG }}
78+
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
79+
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max
80+
build-args: |
81+
BUILD_VERSION=${{ steps.build_tag_generator.outputs.RELEASE_TAG }}
82+
GIT_REF=${{ github.ref }}

.github/workflows/docker.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[workspace]
22

3+
package.license-file = "LICENSE"
4+
35
members = [
46
"firefly-balius",
57
"firefly-cardanoconnect",
@@ -14,3 +16,6 @@ members = [
1416
exclude = ["wasm"]
1517

1618
resolver = "2"
19+
20+
[workspace.metadata.release]
21+
tag = false

0 commit comments

Comments
 (0)