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: Create and publish a Docker image | |
on: | |
release: | |
types: | |
- created | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }}-proxy | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Get the version | |
id: get_version | |
run: | | |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
${{ env.VERSION }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: kbatch-proxy | |
file: kbatch-proxy/docker/production/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Install release dependencies | |
run: | | |
python -m pip install --upgrade build twine | |
- name: Build and publish kbatch | |
env: | |
TWINE_USERNAME: "__token__" | |
TWINE_PASSWORD: ${{ secrets.KBATCH_PYPI_PASSWORD }} | |
run: | | |
cd kbatch | |
python -m build | |
twine upload dist/* | |
- name: Build and publish kbatch-proxy | |
env: | |
TWINE_USERNAME: "__token__" | |
TWINE_PASSWORD: ${{ secrets.KBATCH_PROXY_PYPI_PASSWORD }} | |
run: | | |
cd kbatch-proxy | |
python -m build | |
twine upload dist/* | |
cd .. |