Fix Package Builds (#82)

This commit is contained in:
Sterling Dreyer 2024-10-02 10:51:18 -07:00 committed by GitHub
parent 7e352fbe91
commit e7b937e393
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 16 deletions

View file

@ -66,7 +66,7 @@ jobs:
elif [[ $GITHUB_REF == refs/tags/* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "VERSION=$(date +'%Y.%m.%d').dev0" >> $GITHUB_ENV
echo "VERSION=$(date +'%Y.%-m.%-d').dev0" >> $GITHUB_ENV
fi
- name: Build and push Actor image
@ -82,19 +82,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: gh workflow -R ArcadeAI/Team run Deploy -f actor-version=${{ env.VERSION }}
- name: Build Dev Python Package
if: github.event_name == 'push'
run: |
make set-version VERSION="0.0.0.dev"
make build
- name: Build Prod Python Package
if: github.event_name != 'push'
run: |
make set-version VERSION=${{ env.VERSION }}
make build
- name: Set TAR and WHL names
run: |
export PKG=$(ls arcade/dist/ | grep tar)
@ -164,4 +151,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: arcade/dist/
path: dist/

View file

@ -32,6 +32,11 @@ set-version: ## Set the version in the pyproject.toml file
@echo "🚀 Setting version in pyproject.toml"
@cd arcade && poetry version $(VERSION)
.PHONY: unset-version
unset-version: ## Set the version in the pyproject.toml file
@echo "🚀 Setting version in pyproject.toml"
@cd arcade && poetry version 0.1.0
.PHONY: build
build: clean-build ## Build wheel file using poetry
@echo "🚀 Creating wheel file"
@ -62,6 +67,10 @@ docker: ## Build and run the Docker container
@cd docker && make docker-build
@cd docker && make docker-run
.PHONY: publish-ecr
publish-ecr: ## Publish to the ECR
@cd docker && make publish-ecr
.PHONY: full-dist
full-dist: clean-dist ## Build all projects and copy wheels to ./dist
@echo " Building a full distribution with toolkits"
@ -79,14 +88,21 @@ full-dist: clean-dist ## Build all projects and copy wheels to ./dist
# Copy the main arcade project wheel to the dist directory
@cp arcade/dist/*.whl dist/
@echo "Reset version to default (0.1.0)"
@make unset-version
@echo "🛠️ Building all projects and copying wheels to ./dist"
# Build and copy wheels for each toolkit
@for toolkit_dir in toolkits/*; do \
if [ -d "$$toolkit_dir" ]; then \
toolkit_name=$$(basename "$$toolkit_dir"); \
echo "Building $$toolkit_name project..."; \
cd "$$toolkit_dir" && poetry build; \
cd "$$toolkit_dir" && poetry version $(VERSION); \
awk '{gsub(/arcade-ai = "0.1.\*"/, "arcade-ai = \"$(VERSION)\"")}1' pyproject.toml > temp_file && mv temp_file pyproject.toml; \
poetry build; \
cp dist/*.whl ../../dist/toolkits; \
poetry version 0.1.0; \
awk '{gsub(/arcade-ai = "$(VERSION)"/, "arcade-ai = \"0.1.\*\"")}1' pyproject.toml > temp_file && mv temp_file pyproject.toml; \
cd -; \
fi; \
done