Merge pull request #192 from cloudblue/LITE-30818-bump-deps #152
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: Deploy CloudBlue Connect EaaS Extension Runner | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry install | |
- name: Linting | |
run: | | |
poetry run flake8 | |
- name: Testing | |
run: | | |
poetry run pytest | |
- name: Extract tag name | |
uses: actions/github-script@v6 | |
id: tag | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
result-encoding: string | |
script: | | |
return context.payload.ref.replace(/refs\/tags\//, '') | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
poetry version ${{ steps.tag.outputs.result }} | |
poetry build | |
if [ "$(curl -s -o /dev/null -w '%{http_code}' https://pypi.org/pypi/connect-extension-runner/${{ steps.tag.outputs.result }}/json)" = "404" ]; then poetry publish -u $TWINE_USERNAME -p $TWINE_PASSWORD; fi | |
- name: Set Connect and Runner major versions | |
id: cnctver | |
run: | | |
echo connect_major="$(curl -sI https://api.connect.cloudblue.com/public/v1|grep -Fi 'connect-version' | tr -d '\r' | sed -En 's/^Connect-Version: (.*)/\1/p'|cut -f1 -d'.')" >> $GITHUB_OUTPUT | |
echo runner_major="$(echo ${{ steps.tag.outputs.result }}|cut -f1 -d '.')" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: amd64,arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: cloudblueconnect/connect-extension-runner | |
tags: | | |
type=semver,pattern={{major}}.{{minor}},value=${{ steps.tag.outputs.result }}.0 | |
type=semver,pattern={{major}},value=${{ steps.tag.outputs.result }}.0 | |
type=raw,value=latest,enable=${{ steps.cnctver.outputs.connect_major == steps.cnctver.outputs.runner_major }} | |
flavor: | | |
latest=false | |
- name: Build and push docker image | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
build-args: | | |
RUNNER_VERSION=${{ steps.tag.outputs.result }} | |
tags: ${{ steps.meta.outputs.tags }} | |
- name: Docker image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |