Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Add Github Actions deploy workflow #1

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This is a basic workflow to help you get started with Actions

name: deploy

on:
push:
branches: [main]
tags: [v*]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

env:
AUTODEPLOY_TAG: ${{ secrets.AUTODEPLOY_TAG }}
AUTODEPLOY_URL: https://dfusion.auto.gnosisdev.com/services/dfusion-v2-optimizer-api-mainnet,dfusion-v2-optimizer-api-testnets/rollout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this URL correct?

AUTODEPLOY_TOKEN: ${{ secrets.AUTODEPLOY_TOKEN }}
AWS_REGION: ${{ secrets.AWS_REGION }}
REGISTRY_URI: ${{ secrets.REGISTRY_URI }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- run: docker/deploy.sh ${GITHUB_REF#refs/*/}
29 changes: 29 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM rust:nightly-buster-slim as build

# create a new empty shell project
RUN USER=root cargo new --bin hdnode
WORKDIR /hdnode

# copy over your manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml

# this build step will cache your dependencies
RUN cargo build --release
RUN rm src/*.rs

# copy your source tree
COPY ./src ./src

# build for release
RUN rm ./target/release/deps/hdnode*
RUN cargo build --release

# our final base
FROM rust:nightly-buster-slim

# copy the build artifact from the build stage
COPY --from=build /hdnode/target/release/hdnode .

# set the startup command to run your binary
CMD ["./hdnode"]
11 changes: 11 additions & 0 deletions docker/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -uo pipefail

# Get login token and execute login
sudo pip install awscli
$(aws ecr get-login --no-include-email --region $AWS_REGION)

echo "Tagging latest image with solver...";
docker build --tag $REGISTRY_URI:$1 -f docker/Dockerfile .
echo "Pushing image";
docker push $REGISTRY_URI:$1