-
Notifications
You must be signed in to change notification settings - Fork 1
222 lines (209 loc) · 6.49 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Build and Push rosetta
on:
push:
branches:
- ekw/SRE-999/release-rosetta
tags:
- "*.*.*"
env:
RUST_IMAGE_TAG: '1.73'
IAM_ROLE: "arn:aws:iam::192549843005:role/github_concordium-rosetta"
BASE_IMAGE: "debian:bullseye-slim"
permissions:
id-token: write
contents: read
jobs:
rosetta-version:
runs-on: ubuntu-latest
outputs:
OUTFILE_SHORT: ${{steps.version.outputs.outfile}}
OUTFOLDER: "s3://distribution.concordium.software/tools"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
submodules: recursive
- name: Get the rosetta version
id: version
run: |
CARGO_VERSION=$(yq .package.version "Cargo.toml")
if [ ! "${{ github.ref_name }}" = "$CARGO_VERSION" ] ; then
echo "::error::$CARGO_VERSION does not match ${{ github.ref_name }}."
exit 1
fi
echo "outfile=concordium-rosetta-test-$CARGO_VERSION" >> $GITHUB_OUTPUT
# release-rosetta-macos:
# needs: rosetta-version
# runs-on: macos-latest
# environment: release
# env:
# OUTFILE: ${{needs.rosetta-version.outputs.OUTFOLDER}}/macos/${{needs.rosetta-version.outputs.OUTFILE_SHORT}}
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v4
# with:
# ref: ${{ github.ref_name }}
# submodules: recursive
#
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-region: "eu-west-1"
# role-to-assume: ${{ env.IAM_ROLE }}
# role-session-name: ReleaseRosettaSession
#
#
# - name: Check if version exist in s3
# run: |
# set +e
# output=$(aws s3 ls "${{ env.OUTFILE }}")
# ec=$?
# if [ $ec -eq "0" ]; then
# echo "Objects found ${{ env.OUTFILE }}"
# exit 1
# elif [ $ec -ne "1" ]; then
# echo "$output"
# fi
#
# - name: Build
# run: |
# rustup default ${{ env.RUST_IMAGE_TAG }}
# cargo run --release -- --version
#
# - name: Publish
# run: |
# ls ./target/release/concordium-rosetta
# aws s3 cp ./target/release/concordium-rosetta ${{ env.OUTFILE }}
#
# release-rosetta-windows:
# runs-on: windows-latest
# needs: rosetta-version
# environment: release
# env:
# OUTFILE: "${{needs.rosetta-version.outputs.OUTFOLDER}}/windows/${{needs.rosetta-version.outputs.OUTFILE_SHORT}}.exe"
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v4
# with:
# ref: ${{ github.ref_name }}
# submodules: recursive
#
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-region: "eu-west-1"
# role-to-assume: ${{ env.IAM_ROLE }}
# role-session-name: ReleaseRosettaSession
#
#
# - name: Check if version exist in s3
# run: |-
# set +e
# output=$(aws s3 ls "${{ env.OUTFILE }}")
# ec=$?
# if [ $ec -eq "0" ]; then
# echo "Objects found ${{ env.OUTFILE }}"
# exit 1
# elif [ $ec -ne "1" ]; then
# echo "$output"
# fi
# shell: bash
#
# - name: Build
# run: |
# rustup default ${{ env.RUST_IMAGE_TAG }}
# cargo run --release -- --version
#
# - name: Publish
# run: |
# ls ./target/release/concordium-rosetta.exe
# aws s3 cp ./target/release/concordium-rosetta.exe ${{ env.OUTFILE }}
release-rosetta-docker:
runs-on: ubuntu-latest
environment: release
steps:
- name: Login to Docker Hub
if: ${{ secrets.DOCKERHUB_TOKEN }}
uses: docker/login-action@v3
with:
username: 'concordium'
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
submodules: recursive
- name: Set image tag if correctly formatted
run: |
TAG_VERSION="1.2.0"#${{ github.ref_name }}
if [ -n "Cargo.toml" ] ; then
CARGO_VERSION=$(yq .package.version "Cargo.toml")
if [ ! "$TAG_VERSION" = "$CARGO_VERSION" ] ; then
echo "::error::$CARGO_VERSION does not match $TAG_VERSION."
exit 1
fi
fi
echo "FULL_IMAGE_TAG=concordium/rosetta:${TAG_VERSION}" >> $GITHUB_ENV
- name: Check if image exist
run: |
set +e
docker manifest inspect ${{ env.FULL_IMAGE_TAG }}
EXITCODE=$?
if [ $EXITCODE -eq "0" ]; then
echo "Error: ${{ env.FULL_IMAGE_TAG }} already exist"
exit 1
fi
- name: Build and push docker image
uses: docker/build-push-action@v6
with:
context: '.'
file: Dockerfile
tags: ${{ env.FULL_IMAGE_TAG }}-dev
no-cache: true
push: true
build-args: |
base_image=${{ env.BASE_IMAGE }}
build_image=rust:${{ env.RUST_IMAGE_TAG }}-slim-bullseye
# release-rosetta-linux:
# runs-on: ubuntu-latest
# needs: rosetta-version
# environment: release
# env:
# OUTFILE: ${{needs.rosetta-version.outputs.OUTFOLDER}}/linux/${{needs.rosetta-version.outputs.OUTFILE_SHORT}}
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v4
# with:
# ref: ${{ github.ref_name }}
# submodules: recursive
#
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-region: "eu-west-1"
# role-to-assume: ${{ env.IAM_ROLE }}
# role-session-name: ReleaseRosettaSession
#
#
# - name: Check if version exist in s3
# run: |-
# set +e
# output=$(aws s3 ls "${{ env.OUTFILE }}")
# ec=$?
# if [ $ec -eq "0" ]; then
# echo "Objects found ${{ env.OUTFILE }}"
# exit 1
# elif [ $ec -ne "1" ]; then
# echo "$output"
# fi
#
# - name: Build
# run: |
# rustup default ${{ env.RUST_IMAGE_TAG }}
# cargo run --release -- --version
#
# - name: Publish
# run: |
# ls ./target/release/concordium-rosetta
# aws s3 cp ./target/release/concordium-rosetta ${{ env.OUTFILE }}