Skip to content

Merge pull request #696 from basetenlabs/bump-version-0.7.11 #67

Merge pull request #696 from basetenlabs/bump-version-0.7.11

Merge pull request #696 from basetenlabs/bump-version-0.7.11 #67

Workflow file for this run

name: Release CI
on:
push:
branches:
- release
concurrency:
group: release-${{ github.head_ref || github.run_id }}
cancel-in-progress: false
jobs:
detect-version-changed:
runs-on: ubuntu-20.04
outputs:
version_changed: ${{ steps.versions.outputs.version_changed }}
new_version: ${{ steps.versions.outputs.new_version }}
new_base_image_version: ${{ steps.versions.outputs.new_base_image_version }}
build_base_images: ${{ steps.versions.outputs.build_base_images }}
release_version: ${{ steps.versions.outputs.release_version }}
is_prerelease_version: ${{ steps.versions.outputs.is_prerelease_version }}
steps:
- uses: actions/checkout@v3
with:
# We need to use a different github token because GITHUB_TOKEN cannot trigger a workflow from another
token: ${{secrets.BASETENBOT_GITHUB_TOKEN}}
fetch-depth: 2
- uses: ./.github/actions/detect-versions/
id: versions
build-n-push-context-builder-image:
needs: [detect-version-changed]
if: ${{ !failure() && !cancelled() && needs.detect-version-changed.outputs.release_version == 'true' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: baseten/truss-context-builder
- name: Docker Build
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./context_builder.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: baseten/truss-context-builder:v${{ needs.detect-version-changed.outputs.new_version }}
labels: ${{ steps.meta.outputs.labels }}
publish-to-pypi:
needs: [detect-version-changed]
if: ${{ !failure() && !cancelled() && needs.detect-version-changed.outputs.release_version == 'true' }}
runs-on: ubuntu-20.04
steps:
- name: "Git tag release"
uses: actions/checkout@v3
with:
token: ${{secrets.BASETENBOT_GITHUB_TOKEN}}
- run: |
NEW_VERSION=v${{ needs.detect-version-changed.outputs.new_version }}
git config --global user.name "Github action"
git config --global user.email "github.action@baseten.co"
git tag -a $NEW_VERSION -m "Release $NEW_VERSION"
git push origin $NEW_VERSION
- uses: ./.github/actions/setup-python/
- name: Install poetry packages
run: poetry install --no-dev
- name: Build
run: poetry build
- name: Create Release
uses: ncipollo/release-action@v1.12.0
with:
artifacts: "dist/*"
token: ${{ secrets.BASETENBOT_GITHUB_TOKEN }}
draft: false
prerelease: ${{ needs.detect-version-changed.outputs.is_prerelease_version }}
generateReleaseNotes: true
makeLatest: true
skipIfReleaseExists: true
tag: "v${{ needs.detect-version-changed.outputs.new_version }}"
- name: Publish to PyPI
if: ${{ github.event_name != 'pull_request' }}
run: poetry publish -u "${{ secrets.PYPI_USERNAME }}" -p "${{ secrets.PYPI_PASSWORD }}"