🧹Deleted unused snapshots (#1492) #128
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: Release Toolkit | |
on: | |
push: | |
branches: | |
- main | |
env: | |
PYTHON_VERSION: '3.11' | |
POETRY_VERSION: '2.0.1' | |
jobs: | |
release-pypi-docker-hub: | |
runs-on: ubuntu-latest | |
environment: CD | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: false | |
- name: Install dependencies | |
run: poetry sync | |
- name: Dump last commit message to file | |
run: git log -1 --pretty=%B > last_git_message.txt | |
- name: Dump last tag to file | |
run: git describe --tags --abbrev=0 > last_version.txt | |
- name: Bump Version | |
run: python dev.py bump --verbose | |
- id: version | |
name: Read the new version | |
# Read the version from the cognite_toolkit/_version.py file | |
run: echo "version=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' cognite_toolkit/_version.py)" >> $GITHUB_ENV | |
- name: Create CHANGELOG entry | |
if: env.version != '0.0.0' | |
run: python dev.py changelog | |
- name: Build package | |
if: env.version != '0.0.0' | |
run: poetry build | |
- name: Release to PyPI | |
if: env.version != '0.0.0' | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: twine upload --skip-existing --verbose dist/* | |
- name: Add entry to CHANGELOG | |
if: env.version != '0.0.0' | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
prerelease: false | |
draft: false | |
tag: ${{ env.version }} | |
bodyFile: last_changelog_entry.md | |
- name: Login to Docker Hub | |
if: env.version != '0.0.0' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
- name: Set up Docker Buildx | |
if: env.version != '0.0.0' | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
if: env.version != '0.0.0' | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: cognite/toolkit:${{ env.version }}, cognite/toolkit:latest |