23
23
runs-on : ubuntu-latest
24
24
strategy :
25
25
matrix :
26
- config :
27
- - {
28
- binary_name : " iota-gas-station" ,
29
- docker_repo : " iotaledger/gas-station" ,
30
- runner : " ubuntu-latest" ,
31
- platform : " linux/amd64" ,
32
- }
33
- - {
34
- binary_name : " iota-gas-station" ,
35
- docker_repo : " iotaledger/gas-station" ,
36
- runner : " macos-latest" ,
37
- platform : " linux/arm64/v8" ,
38
- }
39
-
40
- - {
41
- binary_name : " tool" ,
42
- docker_repo : " iotaledger/gas-station-tool" ,
43
- runner : " ubuntu-latest" ,
44
- platform : " linux/amd64" ,
45
- }
46
- - {
47
- binary_name : " tool" ,
48
- docker_repo : " iotaledger/gas-station-tool" ,
49
- runner : " macos-latest" ,
50
- platform : " linux/arm64/v8" ,
51
- }
26
+ image :
27
+ - { name: "iota-gas-station", repo: "iotaledger/gas-station" }
28
+ - { name: "tool", repo: "iotaledger/gas-station-tool" }
52
29
steps :
53
30
- name : Check out the repo
54
31
uses : actions/checkout@v4
@@ -61,91 +38,21 @@ jobs:
61
38
username : ${{ secrets.IOTALEDGER_DOCKER_USERNAME }}
62
39
password : ${{ secrets.IOTALEDGER_DOCKER_PASSWORD }}
63
40
64
- - name : Set up Docker Buildx
65
- uses : docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
66
-
67
- - name : Local Image Names
68
- id : names
69
- run : |
70
- echo "local_image=${{ matrix.config.binary_name }}-${{ matrix.config.runner }}" >> $GITHUB_OUTPUT
71
- echo "ext_image=${{ matrix.config.docker_repo }}:${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
72
-
73
- - name : Build docker image (DRY-RUN) ${{ matrix.config.docker_repo }} - ${{ matrix.config.platform }}
74
- if : ${{ github.event.inputs.is-dry-run == 'true' }}
75
- run : |
76
- ENTRY_BINARY=${{ matrix.config.binary_name }} docker/build.sh \
77
- -t ${{ steps.names.outputs.ext_image }} \
78
- --platform ${{ matrix.config.platform }}
79
-
80
- - name : Build & Push docker image Build docker image ${{ matrix.config.docker_repo }} - ${{ matrix.config.platform }}
81
- if : ${{ github.event.inputs.is-dry-run == 'false' }}
82
- id : build-push-image
41
+ - name : Build image with build.sh
83
42
run : |
84
- ENTRY_BINARY=${{ matrix.config.binary_name }} docker/build.sh \
85
- --platform ${{ matrix.config.platform }} \
86
- --output type=image,"name=${{ matrix.config.docker_repo }}",push-by-digest=true,name-canonical=true,push=true \
87
- --iidfile docker.id
88
-
89
- DOCKER_ID=$(cat docker.id)
90
- DIGEST=$(docker manifest inspect ${{ matrix.config.docker_repo }}@${DOCKER_ID} | jq -r '.manifests[0].digest')
91
- echo "Obtained the docker image $DIGEST"
92
- echo "digest=$DIGEST" >> "$GITHUB_OUTPUT"
93
-
94
- - name : Export digest
95
- if : ${{ github.event.inputs.is-dry-run == 'false' }}
96
- run : |
97
- mkdir -p ${{ runner.temp }}/digests/${{ github.sha }}
98
- digest="${{ steps.build-push-image.outputs.digest }}"
99
- touch "${{ runner.temp }}/digests/${{ github.sha}}/${digest#sha256:}"
100
-
101
- - name : Upload digest
102
- if : ${{ steps.build-push-image.outputs.digest != '' }}
103
- uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
104
- with :
105
- name : digests-${{ github.sha }}-${{ matrix.config.binary_name }}-${{ matrix.config.runner }}
106
- path : ${{ runner.temp }}/digests/${{ github.sha }}/*
107
- if-no-files-found : error
108
- retention-days : 1
109
-
110
- push-index :
111
- if : ${{ github.event.inputs.is-dry-run == 'false' }}
112
- environment : release
113
- needs : push_to_registry
114
- runs-on : ubuntu-latest
115
- strategy :
116
- matrix :
117
- config :
118
- - {
119
- binary_name : " iota-gas-station" ,
120
- docker_repo : " iotaledger/gas-station" ,
121
- }
122
- - { binary_name: "tool", docker_repo: "iotaledger/gas-station-tool" }
123
-
124
- steps :
125
- - name : Login to Docker Registry
126
- uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
127
- with :
128
- username : ${{ secrets.IOTALEDGER_DOCKER_USERNAME }}
129
- password : ${{ secrets.IOTALEDGER_DOCKER_PASSWORD }}
130
-
131
- - name : Set up Docker Buildx
132
- uses : docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
133
-
134
- - name : Download digests
135
- uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
136
- with :
137
- path : ${{ runner.temp }}/digests
138
- pattern : digests-${{ github.sha }}-${{ matrix.config.binary_name }}-*
139
- merge-multiple : true
43
+ ENTRY_BINARY=${{ matrix.image.name }} docker/build.sh -t ${{ matrix.image.repo }}:${{ github.event.inputs.tag }}
140
44
141
- - name : Push multi-platform index
45
+ - name : Push docker image
46
+ if : ${{ github.event.inputs.is-dry-run != 'true' }}
142
47
run : |
143
- cmd="docker buildx imagetools create --tag ${{ matrix.config.docker_repo }}:${{ github.event.inputs.tag }}"
144
- for file in ${{ runner.temp }}/digests/*; do
145
- # Extract the filename (which is the hash).
146
- hash=$(basename "$file")
147
- # Append the amend option for the current hash.
148
- cmd+=" ${{ matrix.config.docker_repo }}@sha256:$hash"
149
- done
150
- echo -e "$cmd"
151
- eval "$cmd"
48
+ docker push ${{ matrix.image.repo }}:${{ github.event.inputs.tag }}
49
+
50
+ # - name: Docker Hub Description for ${{ matrix.image.repo }}
51
+ # if: ${{ github.event.inputs.is-dry-run == 'false'}}
52
+ # uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae
53
+ # with:
54
+ # username: ${{ secrets.IOTALEDGER_DOCKER_USERNAME }}
55
+ # password: ${{ secrets.IOTALEDGER_DOCKER_PASSWORD }}
56
+ # repository: ${{ matrix.image.repo }}
57
+ # readme-filepath: ./README.md
58
+ # short-description: ${{ github.event.repository.description }}
0 commit comments