Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ekw/sre 999/release rosetta #71

Merged
merged 51 commits into from
Nov 27, 2024
Merged
Changes from 50 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1cf3853
Add release flow for rosetta
EmilKWarmdahl Nov 19, 2024
f22dd6e
Update role name
EmilKWarmdahl Nov 19, 2024
e7536cb
Remove if statement for testing
EmilKWarmdahl Nov 19, 2024
87aa6e0
Remove if statement for testing
EmilKWarmdahl Nov 19, 2024
f20eb1c
Add network
EmilKWarmdahl Nov 19, 2024
3ac94de
Try version
EmilKWarmdahl Nov 19, 2024
d73e7c4
Add windows build
EmilKWarmdahl Nov 19, 2024
bad4590
Get version in another job
EmilKWarmdahl Nov 19, 2024
9eba94b
Get version in another job
EmilKWarmdahl Nov 19, 2024
90b425e
Get version in another job
EmilKWarmdahl Nov 19, 2024
5b8731a
Add needs
EmilKWarmdahl Nov 19, 2024
1821f80
remove 'fi'
EmilKWarmdahl Nov 19, 2024
8955143
Use outputs
EmilKWarmdahl Nov 19, 2024
0b7fef3
Change if statement to match powershell syntax
EmilKWarmdahl Nov 19, 2024
801d553
Change if statement to match powershell syntax
EmilKWarmdahl Nov 19, 2024
c8d5bd7
Change if statement to match powershell syntax
EmilKWarmdahl Nov 19, 2024
b581d76
Change if statement to match powershell syntax
EmilKWarmdahl Nov 19, 2024
5220362
change name of output file
EmilKWarmdahl Nov 19, 2024
3ddd097
Format
EmilKWarmdahl Nov 19, 2024
137e161
powershell syntax
EmilKWarmdahl Nov 19, 2024
6efa959
powershell syntax
EmilKWarmdahl Nov 19, 2024
dbb5e05
powershell syntax
EmilKWarmdahl Nov 19, 2024
78d5f1f
Try try-catch
EmilKWarmdahl Nov 19, 2024
cec1cf4
Try try-catch
EmilKWarmdahl Nov 19, 2024
28dca38
Set ErrorActionPreference
EmilKWarmdahl Nov 19, 2024
163ba12
Silently continue
EmilKWarmdahl Nov 19, 2024
4281c10
continue
EmilKWarmdahl Nov 19, 2024
a327b68
Set shell explicitly
EmilKWarmdahl Nov 19, 2024
24850c8
Set shell explicitly
EmilKWarmdahl Nov 19, 2024
03847b7
Try bash
EmilKWarmdahl Nov 19, 2024
cb5c75f
Add docker build
EmilKWarmdahl Nov 20, 2024
050a385
Update build step
EmilKWarmdahl Nov 20, 2024
8761b18
Upper case C in Cargo.toml
EmilKWarmdahl Nov 20, 2024
d22fe27
Hardcoded version for testing
EmilKWarmdahl Nov 20, 2024
7ff5719
No quotes in build args
EmilKWarmdahl Nov 20, 2024
caed08b
Push artifacts
EmilKWarmdahl Nov 20, 2024
daf66a2
Add linux build
EmilKWarmdahl Nov 20, 2024
9186617
Use job outputs
EmilKWarmdahl Nov 20, 2024
dc43b1f
Hardcode version for testing
EmilKWarmdahl Nov 20, 2024
0315dc9
Look at folder instead of file
EmilKWarmdahl Nov 20, 2024
b5bbc60
Don't use .deb on linux
EmilKWarmdahl Nov 20, 2024
45e9551
Full dry-run test
EmilKWarmdahl Nov 20, 2024
c7c64c9
Full dry-run test
EmilKWarmdahl Nov 20, 2024
fd0a164
Full dry-run test
EmilKWarmdahl Nov 20, 2024
58abd6d
Full dry-run test
EmilKWarmdahl Nov 20, 2024
48a88db
Test docker push
EmilKWarmdahl Nov 20, 2024
69baa4f
Remove if
EmilKWarmdahl Nov 21, 2024
d4ecefc
Run on branch
EmilKWarmdahl Nov 21, 2024
4743011
Test docker push
EmilKWarmdahl Nov 21, 2024
00015ac
Revert state to non test
EmilKWarmdahl Nov 21, 2024
4b622ca
Change name to RUST_VERSION instead of RUST_IMAGE_TAG
EmilKWarmdahl Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 216 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
name: Build and Push rosetta

on:
push:
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: |
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: |
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
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=${{ 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 }}
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: |
aws s3 cp ./target/release/concordium-rosetta ${{ env.OUTFILE }}
Loading