ci: added push to docker hub of readme and renamed conda environment … #127
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
semantic_release: | |
runs-on: ubuntu-latest | |
name: Runs semantic release | |
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.released == 'true' | |
run: | | |
export RELEASE_VERSION=$(echo ${{ steps.semantic.outputs.tag }} | cut -c 2-) | |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
docker buildx create --name mybuilder --platform linux/amd64,linux/arm64 --use | |
pushd docker/deepsea-ai && docker buildx build --push --platform linux/amd64,linux/arm64 -t mbari/deepsea-ai:$RELEASE_VERSION --label IMAGE_URI=mbari/deepsea-ai:$RELEASE_VERSION . | |
popd | |
pushd docker/ecs-autoscale && docker buildx build --push --platform linux/amd64,linux/arm64 -t mbari/ecs-autoscale:$RELEASE_VERSION --label IMAGE_URI=mbari/ecs-autoscale:$RELEASE_VERSION . | |
push_readme_to_dockerhub: | |
runs-on: ubuntu-latest | |
name: Push README to Docker Hub | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v2 | |
- name: push README to Dockerhub | |
uses: christian-korneck/update-container-description-action@v1 | |
env: | |
DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }} | |
with: | |
destination_container_repo: mbari/deepsea-ai:latest | |
provider: dockerhub | |
short_description: 'Simplify processing deep sea video in AWS in SageMaker or ECS.' | |
readme_file: 'README.md' | |
pypi_release: | |
name: Builds Using Poetry and Publishes to PyPI | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
if: ${{ needs.semantic.outputs.new-release-published == 'true' }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry | |
run: curl -sSL https://install.python-poetry.org | python3 - | |
- name: Add Poetry to path | |
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH | |
- run: poetry install | |
- name: Suppress sqlachemy warning | |
run: echo "SQLALCHEMY_SILENCE_UBER_WARNING=1" >> $GITHUB_ENV | |
- run: SAGEMAKER_ROLE=${{ secrets.SAGEMAKER_ROLE }} AWS_DEFAULT_REGION=us-west-2 poetry run pytest | |
- run: poetry config pypi-token.pypi "${{ secrets.PYPI_API_TOKEN }}" | |
- name: Publish package | |
run: poetry publish --build |