Skip to content

ci: slim with two stage docker build, added explicit semantic release… #52

ci: slim with two stage docker build, added explicit semantic release…

ci: slim with two stage docker build, added explicit semantic release… #52

Workflow file for this run

name: New Release
on:
workflow_dispatch:
push:
branches:
- main
jobs:
semantic_release:
runs-on: ubuntu-latest
concurrency: semantic_release
permissions:
id-token: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install
- name: Set PYTHONPATH to subdirectory sdcat
run: echo "PYTHONPATH=." >> $GITHUB_ENV
- name: Check release status
id: release-status
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install python-semantic-release
if semantic-release --noop --strict version
then
echo "Releasing new version."
else
echo "Skipping release steps."
fi
- if: steps.release-status.outputs.released == 'true'
name: Release to GitHub
id: github-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
semantic-release version
git fetch --tags
for file in ./dist/**
do gh release upload "${{steps.release-status.outputs.tag}}" $file
done
- if: steps.release-status.outputs.released == 'true'
name: Release to Test PyPI
id: test-pypi-release
env:
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi $TEST_PYPI_TOKEN
poetry publish -r test-pypi -u __token__
- if: steps.release-status.outputs.released == 'true'
name: docker push version
run: |
export RELEASE_VERSION=$(echo ${{ steps.release-status.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
docker buildx build --push --platform linux/amd64 -t mbari/sdcat:$RELEASE_VERSION-cuda124 --label GIT_VERSION=$RELEASE_VERSION --label IMAGE_URI=mbari/sdcat:$RELEASE_VERSION-cuda124 -f docker/Dockerfile.cuda .
docker buildx build --push --platform linux/amd64,linux/arm64 -t mbari/sdcat:$RELEASE_VERSION --label GIT_VERSION=$RELEASE_VERSION --label IMAGE_URI=mbari/sdcat:$RELEASE_VERSION -f docker/Dockerfile .
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/sdcat:latest
provider: dockerhub
short_description: 'Sliced Detection and Clustering Analysis Toolkit (SDCAT)'
readme_file: 'README.md'