Skip to content

Commit

Permalink
fix: add temporary workflow for pushing docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
Divya-Solulab committed Nov 29, 2024
1 parent d1853bd commit 00fd60d
Showing 1 changed file with 104 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/push_docker_images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Temporary Push Docker Images

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build from'
required: true
default: 'main'
push:
tags:
- 'dev.*'
pull_request:
branches:
- main

jobs:
publish-packages:
name: Push Packages
runs-on: ubuntu-20.04
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-versions }}
- uses: addnab/docker-run-action@v3
with:
image: valory/open-autonomy-user:latest
options: -v ${{ github.workspace }}:/work
run: |
echo "Pushing Packages"
cd /work
export AUTHOR=$(grep 'service' packages/packages.json | awk -F/ '{print $2}' | head -1)
autonomy init --reset --author $AUTHOR --ipfs --remote
autonomy push-all
publish-images:
name: Publish Docker Images
runs-on: ubuntu-20.04
needs:
- "publish-packages"
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up tag and vars
uses: addnab/docker-run-action@v3
with:
image: valory/open-autonomy-user:latest
options: -v ${{ github.workspace }}:/work
run: |
echo "Setting Tag Images"
cd /work
apt-get update && apt-get install git -y || exit 1
git config --global --add safe.directory /work
export TAG=$(git describe --exact-match --tags $(git rev-parse HEAD)) || exit 1
if [ $? -eq 0 ]; then
export TAG=`echo $TAG | sed 's/^v//'`
else
echo "You are not on a tagged branch"
exit 1
fi
echo VERSION=$TAG> env.sh
echo AUTHOR=$(grep 'service/' packages/packages.json | awk -F/ '{print $2}' | head -1) >> env.sh
echo SERVICE=$(grep 'service/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
echo AGENT=$(grep 'agent/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
echo DEFAULT_IMAGE_TAG=$(cat packages/packages.json | grep agent/ | awk -F: '{print $2}' | tr -d '", ' | head -n 1) >> env.sh
cat env.sh
- uses: addnab/docker-run-action@v3
name: Build Images
with:
image: valory/open-autonomy-user:latest
options: -v ${{ github.workspace }}:/work
shell: bash
run: |
echo "Building Docker Images"
cd /work
source env.sh || exit 1
echo "Building images for $AUTHOR for service $SERVICE"
autonomy init --reset --author $AUTHOR --ipfs --remote
autonomy fetch $AUTHOR/$SERVICE --service --local || exit 1
cd $SERVICE || exit 1
autonomy build-image || exit 1
autonomy build-image --version $VERSION || exit 1
- name: Docker login
run: |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
- name: Docker Push
run: |
source env.sh
echo "Pushing $DOCKER_USER/oar-$AGENT:$VERSION"
echo "Pushing $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG"
docker push $DOCKER_USER/oar-$AGENT:$VERSION
docker push $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG

0 comments on commit 00fd60d

Please sign in to comment.