Skip to content

Update paths

Update paths #118

Workflow file for this run

name: Build and publish
on:
push:
branches:
- "main"
tags:
- '*.*.*'
jobs:
ci_cd:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push (for main branch)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
id: docker_build_main
uses: docker/build-push-action@v2
with:
file: ./Dockerfile
push: true
tags: xscanner/runner:latest
- name: Set output (for tags)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Build and push (for tags)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
id: docker_build_tag
uses: docker/build-push-action@v2
with:
file: ./Dockerfile
push: true
tags: xscanner/runner:${{ steps.vars.outputs.tag }}
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: 3.10.4
- name: Install pypa/build
run: python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .
- name: Publish dev package to TestPyPI (for main branch)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.TEST_PYPI_USERNAME }}
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Publish production package to TestPyPI (for tags)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.TEST_PYPI_USERNAME }}
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Publish production package package to PyPI (for tags)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_TOKEN }}