arcade-mcp/.github/workflows/release-containers.yml
Eric Gustin feb83c95ca
Pin poetry to 1.8.5 (#193)
# PR Description
Poetry released v2 with many breaking changes a couple days ago. The
`install-poetry` action that our workflows use default to that v2
version, so many of our workflows are failing. This PR forces that
action to use poetry version 1.8.5 and also uses 1.8.5 for toolkits

A ticket to migrate to 2.0.0 has been filed for future work
2025-01-07 13:21:55 -08:00

172 lines
5.4 KiB
YAML

name: Release and Publish Containers
on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.0)'
required: true
default: '0.0.1'
env:
REGISTRY: ghcr.io
jobs:
release-and-publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Wait for tests to succeed
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.ref }}
running-workflow-name: 'Main'
repo-token: ${{ secrets.PAT }}
wait-interval: 10
ignore-checks: "release-and-publish"
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to ECR
uses: docker/login-action@v3
with:
registry: 471112909428.dkr.ecr.us-east-1.amazonaws.com
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Set version
id: set_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
elif [[ $GITHUB_REF == refs/tags/* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "VERSION=$(date +'%Y.%-m.%-d').dev0" >> $GITHUB_ENV
fi
- name: Build and push Actor image
id: build
run: |
make docker VERSION=${{ env.VERSION }}
make publish-ecr VERSION=${{ env.VERSION }}
echo "image=471112909428.dkr.ecr.us-east-1.amazonaws.com/arcadeai/arcade-ai:${{ env.VERSION }}" >> $GITHUB_OUTPUT
- name: Deploy to Amazon ECS
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: gh workflow -R ArcadeAI/Team run Deploy -f actor-version=${{ env.VERSION }}
- name: Set TAR and WHL names
run: |
export PKG=$(ls arcade/dist/ | grep tar)
set -- $PKG
echo "TAR_NAME=$1" >> $GITHUB_ENV
export PKG=$(ls arcade/dist/ | grep whl)
set -- $PKG
echo "WHL_NAME=$1" >> $GITHUB_ENV
- name: Generate release notes
id: generate_release_notes
if: github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')
run: |
echo "Release notes for version ${{ env.VERSION }}" > release_notes.md
echo "" >> release_notes.md
echo "Changes in this release:" >> release_notes.md
git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s" >> release_notes.md
- name: Create Release
id: create_release
if: github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body_path: release_notes.md
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
if: github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release_notes.md
asset_name: release_notes.md
asset_content_type: text/markdown
- name: Upload Python Tar Asset
uses: actions/upload-release-asset@v1
if: github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./arcade/dist/${{ env.TAR_NAME }}
asset_name: ${{ env.TAR_NAME }}
asset_content_type: application/zip
- name: Upload Python Whl Asset
uses: actions/upload-release-asset@v1
if: github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./arcade/dist/${{ env.WHL_NAME }}
asset_name: ${{ env.WHL_NAME }}
asset_content_type: application/zip
- name: Zip Full Dist
if: github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')
run: tar -cvf python-package-distributions.tar.gz ./dist
- name: Upload Full Dist
uses: actions/upload-release-asset@v1
if: github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: python-package-distributions.tar.gz
asset_name: python-package-distributions.tar.gz
asset_content_type: application/zip
- name: Upload the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/