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

Add tags for Docker images #146

Merged
merged 2 commits into from
Jul 28, 2023
Merged
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
37 changes: 25 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
on:
release:
types:
- created
push:
branches:
- master

name: deploy

jobs:
set-tags:
name: Get & set tags
runs-on: ubuntu-latest
outputs:
commit_hash: ${{ steps.get-sha.outputs.sha }}
commit_hash8: ${{ steps.get-sha.outputs.sha8 }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get commit SHA
id: get-sha
run: |
sha=$(git log -1 --format='%H')
echo "sha=$sha" >> $GITHUB_OUTPUT
echo "sha8=$(git log -1 --format='%H' | cut -c1-8)" >> $GITHUB_OUTPUT
echo "SHA commit:" $sha

deploy:
runs-on: ubuntu-latest
needs: ["set-tags"]
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
Expand All @@ -27,13 +45,8 @@ jobs:
with:
targets: x86_64-unknown-linux-musl

- run: ./build_connectors.sh
- run: ./push_connectors.sh
- name: Build connector Docker images
run: ./build_connectors.sh

#- uses: withlogicco/setup-compose-cli@v1
#- run: docker context create ecs aws --from-env
#- run: docker --context=aws compose up
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Push connector images to Dockerhub
run: ./push_connectors.sh ${{ needs.set-tags.outputs.commit_hash8 }}
28 changes: 24 additions & 4 deletions push_connectors.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
#!/bin/sh
docker push analoglabs/connector-bitcoin
docker push analoglabs/connector-ethereum
docker push analoglabs/connector-polkadot
docker push analoglabs/connector-astar

# First arg is the Docker image tag on all images
tag=$1

docker push analoglabs/connector-bitcoin:latest
docker push analoglabs/connector-ethereum:latest
docker push analoglabs/connector-polkadot:latest
docker push analoglabs/connector-astar:latest

if [ ! -z "$tag" ]; then
echo "Tagging all images: $tag";
docker tag analoglabs/connector-bitcoin analoglabs/connector-bitcoin:$tag
docker push analoglabs/connector-bitcoin:$tag

docker tag analoglabs/connector-ethereum analoglabs/connector-ethereum:$tag
docker push analoglabs/connector-ethereum:$tag

docker tag analoglabs/connector-polkadot analoglabs/connector-polkadot:$tag
docker push analoglabs/connector-polkadot:$tag

docker tag analoglabs/connector-astar analoglabs/connector-astar:$tag
docker push analoglabs/connector-astar:$tag
fi