Skip to content

Commit

Permalink
Add tags for Docker images (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
penumbra23 authored Jul 28, 2023
1 parent 617bf55 commit a976f8b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 16 deletions.
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

0 comments on commit a976f8b

Please sign in to comment.