chore(main): release 4.10.0 (#428) #165
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: "Job Engine Release" | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: false | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
trigger-release: | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
major: ${{ steps.release.outputs.major }} | |
minor: ${{ steps.release.outputs.minor }} | |
patch: ${{ steps.release.outputs.patch }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
steps: | |
- id: release | |
uses: google-github-actions/release-please-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
target-branch: ${{ github.ref_name }} | |
config-file: .github/release-please-config.json | |
manifest-file: .github/.release-please-manifest.json | |
publish-github: | |
name: "Publish package to GitHub release" | |
needs: trigger-release | |
if: needs.trigger-release.outputs.release_created | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Load cached Poetry installation | |
id: cached-poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local # the path depends on the OS | |
key: poetry-0 # increment to reset cache | |
- name: Setup Poetry | |
uses: snok/install-poetry@v1 | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Build Package | |
run: | | |
poetry build --no-interaction --format=wheel | |
- name: Generate server requirements | |
run: | | |
poetry self add poetry-plugin-export | |
poetry export -f requirements.txt -o dist/requirements.txt --without-hashes --without-urls --with server | |
- name: Save wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: freeze | |
path: dist/ | |
- name: Add artifacts to release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "Uploading artifacts to release ${{ needs.trigger-release.outputs.tag_name }}" | |
gh release upload ${{ needs.trigger-release.outputs.tag_name }} ./dist/*.whl | |
publish-pypi: | |
name: "Publish package to PyPi repository" | |
needs: [publish-github, trigger-release] | |
if: needs.trigger-release.outputs.release_created | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Load cached Poetry installation | |
id: cached-poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local # the path depends on the OS | |
key: poetry-0 # increment to reset cache | |
- name: Setup Poetry | |
uses: snok/install-poetry@v1 | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Build Package | |
run: | | |
poetry build --no-interaction | |
- name: Publish package | |
run: | | |
poetry config repositories.nuvla-job-engine https://pypi.org/project/nuvla-job-engine/ | |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | |
poetry publish | |
publish-docker: | |
name: "Publish package to DockerHub" | |
needs: [publish-github, trigger-release] | |
if: needs.trigger-release.outputs.release_created | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set env | |
shell: bash | |
run: echo "BUILD_TIME=$(date --utc +%FT%T.%3NZ)" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: freeze | |
path: dist/ | |
- name: SetUp QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.SIXSQ_DOCKER_USERNAME }} | |
password: ${{ secrets.SIXSQ_DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 | |
build-args: | | |
GIT_BRANCH=${{ github.head_ref || github.ref_name }} | |
GIT_BUILD_TIME=${{ env.BUILD_TIME }} | |
GIT_COMMIT_ID=${{ github.sha }} | |
PACKAGE_TAG=${{ needs.trigger-release.outputs.tag_name }} | |
GITHUB_RUN_NUMBER=${{ github.run_number }} | |
GITHUB_RUN_ID=${{ github.run_id }} | |
PROJECT_URL=${{ github.server_url }}/${{ github.repository }} | |
PACKAGE_NAME=${{ env.PACKAGE_NAME }} | |
push: true | |
tags: > | |
nuvla/job:${{ needs.trigger-release.outputs.tag_name }}, | |
nuvla/job:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
notify: | |
name: Post Workflow Status To Slack | |
needs: [publish-github, publish-docker, publish-pypi] | |
if: needs.trigger-release.outputs.release_created | |
runs-on: ubuntu-latest | |
steps: | |
- uses: Gamesight/slack-workflow-status@master | |
with: | |
repo_token: ${{secrets.GITHUB_TOKEN}} | |
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} | |
include_commit_message: true |