build: switched release to python semantic release #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: New Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Support running these jobs manually | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install -r src/requirements.txt | |
pip install -r src/app/yolov5/requirements.txt | |
pip install awscli | |
- name: Download data | |
run: | | |
aws s3 cp --no-sign-request s3://902005-public/models/Megadetector/best.pt src/app/model/ | |
aws s3 cp --no-sign-request s3://902005-public/models/Megadetector/labels.txt src/app/model/ | |
- name: Set PYTHONPATH and Run Tests | |
env: | |
PYTHONPATH: src | |
run: pytest | |
semantic_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Python Semantic Release | |
id: semantic | |
uses: python-semantic-release/python-semantic-release@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: docker push version | |
if: steps.semantic.outputs.new-release-published == 'true' | |
run: | | |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
docker buildx create --name mybuilder --platform linux/amd64,linux/arm64 --use | |
docker buildx build --push --platform linux/amd64,linux/arm64 -t mbari/fastapi-yolov5-fargate-elb:$RELEASE_VERSION --label IMAGE_URI=mbari/fastapi-yolov5-fargate-elb:$RELEASE_VERSION -f Dockerfile.aws . | |
cd src && docker buildx build --push --platform linux/amd64,linux/arm64 -t mbari/fastapi-yolov5:$RELEASE_VERSION --label IMAGE_URI=mbari/fastapi-yolov5:$RELEASE_VERSION . |