set minimum coverage to 95%; #22
Workflow file for this run
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: tagged release | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
env: | |
IMAGE_NAME: "koi-api" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "checkout code" | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: "install dependencies" | |
run: pip install build | |
- name: "build wheel and source distribution" | |
run: python -m build | |
- name: "build docker image" | |
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" | |
- name: publish the package as Release v*.*.* | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: "Release ${{ github.ref_name }}" | |
body_path: CHANGELOG.md | |
generate_release_notes: false | |
files: | | |
dist/koi_api-*.whl | |
dist/koi-api-*.tar.gz | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: "publish docker image" | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION |