Skip to content

Commit

Permalink
bump propel-client to v0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
solarw committed Jan 10, 2024
1 parent 4c8f36e commit 17e6453
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 48 deletions.
171 changes: 124 additions & 47 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Release Flow

on:
release:
types: [published]

types: [prereleased, released]
jobs:
publish-packages:
name: Push Packages
Expand All @@ -19,14 +18,14 @@ jobs:
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
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: ${{ matrix.os }}
Expand All @@ -37,60 +36,138 @@ jobs:
os: [ubuntu-latest]
python-version: ["3.10"]
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
steps:
- uses: actions/checkout@v3
- 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 '", ') >> env.sh
cat env.sh
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 '", ') >> 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
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
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
deploy-service-on-propel:
name: Deploy service on propel
needs:
- "publish-packages"
- "publish-images"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
if: github.event_name == 'release'
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-versions }}
- name: Install dependencies
run: |
sudo apt-get update --fix-missing
sudo apt-get autoremove
sudo apt-get autoclean
python -m pip install --upgrade pip
pip install propel-client==0.0.4 open-autonomy
- name: Set service env vars
run: |
# get env vars from github actions from secrets
echo '${{ toJSON(secrets) }}' | jq -r 'to_entries|map("export \(.key)=\(.value|tojson)")|.[]' > github.vars
- name: Do a STAGING deployment
if: github.event.action == 'prereleased'
run: |
# determine ipfs hash id
export IPFS_HASH=$(jq '.dev | to_entries[] | select(.key | startswith("service"))| .value' -r ./packages/packages.json | head -n1)
export SERVICE_PATH=service_for_propel
# fetch service file and check it published
autonomy init --reset --author ci --ipfs --remote
autonomy fetch $IPFS_HASH --service --alias $SERVICE_PATH
# cut of S prefix from vars
sed -e "s/ STAGING_/ /g" -i github.vars
# set proper CMD url
export CMD="propel -U https://app.propel.staging.valory.xyz"
# load env vars
source github.vars
# login
$CMD login -u ${{ secrets.STAGING_PROPEL_USERNAME }} -p ${{ secrets.STAGING_PROPEL_PASSWORD }}
# make service deployment with env var as source of variables
$CMD service deploy --name ${{ vars.STAGING_SERVICE_NAME }} --service-dir $SERVICE_PATH --service-ipfs-hash $IPFS_HASH --keys ${{ vars.STAGING_SERVICE_KEYS }} --timeout 320 | grep -v "Create/update variable"
- name: Do a PRODUCTION deployment
if: github.event.action == 'released'
run: |
# determine ipfs hash id
export IPFS_HASH=$(jq '.dev | to_entries[] | select(.key | startswith("service"))| .value' -r ./packages/packages.json | head -n1)
export SERVICE_PATH=service_for_propel
# fetch service file and check it published
autonomy init --reset --author ci --ipfs --remote
autonomy fetch $IPFS_HASH --service --alias $SERVICE_PATH
# cut of S prefix from vars
sed -e "s/ PRODUCTION_/ /g" -i github.vars
# set proper CMD url
export CMD="propel -U https://app.propel.valory.xyz"
# load env vars
source github.vars
# login
$CMD login -u ${{ secrets.PRODUCTION_PROPEL_USERNAME }} -p ${{ secrets.PRODUCTION_PROPEL_PASSWORD }}
# make service deployment with env var as source of variables
$CMD service deploy --name ${{ vars.PRODUCTION_SERVICE_NAME }} --service-dir $SERVICE_PATH --service-ipfs-hash $IPFS_HASH --keys ${{ vars.PRODUCTION_SERVICE_KEYS }} --timeout 320 | grep -v "Create/update variable"
2 changes: 1 addition & 1 deletion .github/workflows/test_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
sudo apt-get autoremove
sudo apt-get autoclean
python -m pip install --upgrade pip
pip install propel-client==0.0.6 open-autonomy
pip install propel-client==0.0.7 open-autonomy
- name: Login to propel
run: |
Expand Down

0 comments on commit 17e6453

Please sign in to comment.