Fix total_count error and support uptime performance #53
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: "ci" | |
on: | |
push: | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: status-cake-exporter | |
jobs: | |
ci: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v3" | |
with: | |
fetch-depth: 0 | |
- name: "set up python" | |
uses: "actions/setup-python@v2" | |
with: | |
python-version: '3.10' | |
- name: "install poetry" | |
uses: "snok/install-poetry@v1" | |
with: | |
virtualenvs-in-project: true | |
- name: "install dependencies" | |
run: poetry install | |
- name: "build" | |
run: | | |
source $VENV | |
make build | |
- name: "get version" | |
id: "get_version" | |
run: | | |
current_version=$(poetry version -s) | |
echo "version=$current_version" >> $GITHUB_OUTPUT | |
- name: "build image" | |
run: | | |
docker build . --file Dockerfile --tag status-cake-exporter | |
- name: "log into registry" | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: "push image" | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
if [[ "${{ github.ref }}" == "refs/tags/v"* ]]; then | |
docker tag $IMAGE_NAME $IMAGE_ID:$(echo $VERSION | sed -e 's/^v//') | |
# latest should always reflect the most recent tagged release | |
VERSION=latest | |
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
# main represents the latest build from main branch | |
VERSION=main | |
else | |
# dev represents the latest build from prs or branches | |
VERSION=dev | |
fi | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push -a $IMAGE_ID | |
- name: "create release" | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
gh release create v${{ steps.get_version.outputs.version }} ./dist/*.whl --title v${{ steps.get_version.outputs.version }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "publish" | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
poetry config pypi-token.pypi $POETRY_PYPI_TOKEN_PYPI | |
poetry publish | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} | |