Skip to content

Setup docker

Setup docker #169

Workflow file for this run

name: Concordium desktop wallet release
on:
push:
branches:
- 'ekw/SRE-1001/release-desktop-wallet'
tags:
- '*/*.*.*'
env:
BASE_IMAGE_VERSION: "rust-1.74.1_ghc-9.6.4"
TARGET_NET: "mainnet"
STATIC_NODE_BINARY_IMAGE_NAME: 'static-node-binaries'
AWS_ROLE_TO_ASSUME: "arn:aws:iam::192549843005:role/github_concordium-desktop-wallet"
S3_BUCKET: "s3://desktopwallet.concordium.com"
ECR_REPO: "192549843005.dkr.ecr.eu-west-1.amazonaws.com/concordium/desktop-wallet-ci"
WASM-PACK_VERSION: "v0.9.1"
NODE_VERSION: "14.16.0"
permissions:
id-token: write
contents: read
jobs:
login-aws:
runs-on: ubuntu-latest
outputs:
access_key: ${{ steps.login-ecr.outputs.docker_username_192549843005_dkr_ecr_eu_west_1_amazonaws_com }}
secret_key: ${{ steps.login-ecr.outputs.docker_password_192549843005_dkr_ecr_eu_west_1_amazonaws_com }}
CONTAINER_TAG: ${{ steps.version_check.outputs.CONTAINER_TAG }}
VERSION: ${{ steps.version_check.outputs.VERSION }}
environment: release
steps:
- name: aws creds
uses: aws-actions/configure-aws-credentials@v4
id: creds
with:
aws-region: "eu-west-1"
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
role-session-name: ReleaseDesktopWalletSession
mask-aws-account-id: false
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: false
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.ref_name }}
- name: Check version
id: version_check
run: |
# Extract version number
VERSION=$(jq '.version' -r app/package.json)
TAG_VERSION=1.7.4 #${{ github.ref_name }}
if [ "$VERSION" != "$TAG_VERSION" ]; then
echo "Tag version is not correct. Tag version: $TAG_VERSION version from package.json: $VERSION"
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "CONTAINER_TAG=${{ env.ECR_REPO }}:$VERSION" >> $GITHUB_OUTPUT
- name: Check if image exist
run: |
set +e
#aws ecr describe-images --registry-id "192549843005" --repository-name "concordium/desktop-wallet-ci" --region eu-west-1 --image-ids=imageTag=${{ steps.version_check.outputs.VERSION }}
docker pull ${{ steps.version_check.outputs.CONTAINER_TAG }}
echo "EC=254" >> $GITHUB_ENV #echo "EC=$?" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: build ci image
if: ${{ env.EC == 254 }}
uses: docker/build-push-action@v6
with:
push: true
tags: "${{ steps.version_check.outputs.CONTAINER_TAG }}"
context: '.'
file: 'scripts/desktop-wallet-ci.Dockerfile'
cache-from: type=local,src=/$HOME/cache
cache-to: type=local,dest=/$HOME/cache
build-args: |
BASE_VERSION=${{ env.BASE_IMAGE_VERSION }}
NODE_VERSION=${{ env.NODE_VERSION }}
release-desktop-wallet-linux:
environment: release
needs: login-aws
runs-on: ubuntu-latest
container:
image: "${{needs.login-aws.outputs.CONTAINER_TAG}}"
credentials:
username: ${{needs.login-aws.outputs.access_key}}
password: ${{needs.login-aws.outputs.secret_key}}
options: -u root
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.ref_name }}
- name: Login to Amazon ECR
uses: aws-actions/configure-aws-credentials@v4
id: creds
with:
aws-region: "eu-west-1"
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
role-session-name: ReleaseDesktopWalletSession
mask-aws-account-id: false
- name: Generate filename
run: |
set +e
TARGET_NET=${{env.TARGET_NET}}
VERSION=${{ needs.login-aws.outputs.VERSION }}
# Prepare filenames
if [ $TARGET_NET = "mainnet" ]; then
FILENAME="concordium-desktop-wallet-${{ needs.login-aws.outputs.VERSION }}"
else
FILENAME="concordium-desktop-wallet-${TARGET_NET}-${{ needs.login-aws.outputs.VERSION }}"
fi
OUT_FOLDER="${{ env.S3_BUCKET }}/test/${VERSION}/${TARGET_NET}"
echo "OUT_FOLDER=$OUT_FOLDER" >> $GITHUB_ENV
echo "FILENAME=$FILENAME" >> $GITHUB_ENV
- name: Check if Executable exist
run: |
set +e
aws s3 ls "${{ env.OUT_FOLDER }}/latest-linux.yml"
EC=$?
if [ $EC -eq 0 ]; then
echo ".deb file already exist"
exit 1
elif [ $EC -ne 1 ]; then
echo "Error: $EC"
exit 1
fi
echo "EXIT_CODE=$EC" >> $GITHUB_ENV
- name: Output dependency versions
run: |
rustup default stable
echo "::info:: node version: $(node --version)"
echo "::info:: npm version: $(npm --version)"
echo "::info:: yarn version: $(yarn --version)"
echo "::info:: python version: $(python --version)"
echo "::info:: rustup version: $(rustup show)"
echo "::info:: wasm-pack version: $(wasm-pack --version)"
- name: Build and publish
if: ${{ env.EXIT_CODE == 1 }}
run: |
set +e
yarn
yarn package
# Push to s3
aws s3 cp --recursive release/ ${{ env.OUT_FOLDER }} --exclude linux-unpacked/* --exclude builder-debug.yml --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
#using windows-2019 to be able to use visual studio 2019, newer versions do not support older versions of node
release-desktop-wallet-windows:
runs-on: windows-2019
environment: release
needs: login-aws
steps:
- name: aws creds
uses: aws-actions/configure-aws-credentials@v4
id: creds
with:
aws-region: "eu-west-1"
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
role-session-name: ReleaseDesktopWalletSession
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.ref_name }}
- name: Install dependencies
uses: jetli/[email protected]
with:
version: ${{ env.PACK_VERSION }}
- name: install node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Generate filename
shell: bash
run: |
set +e
TARGET_NET=${{env.TARGET_NET}}
VERSION=${{ needs.login-aws.outputs.VERSION }}
if [ $TARGET_NET = "mainnet" ]; then
FILENAME_EXE="concordium-desktop-wallet-${{ needs.login-aws.outputs.VERSION }}.exe"
else
FILENAME_EXE="concordium-desktop-wallet-${TARGET_NET}-${{ needs.login-aws.outputs.VERSION }}.exe"
fi
OUT_FOLDER="${{ env.S3_BUCKET }}/test/${VERSION}/${TARGET_NET}"
echo "OUT_FOLDER=$OUT_FOLDER" >> $GITHUB_ENV
echo "FILENAME=$FILENAME" >> $GITHUB_ENV
- name: Check if executable exist
run: |
aws s3 ls "${{ env.OUT_FOLDER }}/latest.yml"
EC=$?
echo $EC
if [ $EC -eq 0 ]; then
echo "$OUT_OBJECT already exist"
elif [ $EC -ne 1 ]; then
echo "Error: $EC"
fi
echo "EXIT_CODE=$EC" >> $GITHUB_ENV
- name: Output dependency versions
run: |
echo "::info:: node version: $(node --version)"
echo "::info:: npm version: $(npm --version)"
echo "::info:: yarn version: $(yarn --version)"
echo "::info:: python version: $(python --version)"
echo "::info:: rustup version: $(rustup show)"
echo "::info:: wasm-pack version: $(wasm-pack --version)"
- name: Build and push desktop wallet
if: ${{ env.EXIT_CODE == 1 }}
shell: bash
run: |
yarn --network-timeout 1000000
# Build
yarn package-win-no-sign
# Push
aws s3 cp --recursive release/ ${{ env.OUT_FOLDER }} --exclude win-unpacked/* --exclude builder-debug.yml --exclude *.blockmap --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers