Splitting PyPi and DockerHub deployment workflows
This commit is contained in:
59
.github/workflows/ci.yml
vendored
59
.github/workflows/ci.yml
vendored
@ -26,7 +26,6 @@ jobs:
|
||||
tox:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- name: "Test: Python 3.7"
|
||||
@ -82,12 +81,11 @@ jobs:
|
||||
- uses: codecov/codecov-action@v1
|
||||
if: ${{ matrix.coverage }}
|
||||
|
||||
deploy:
|
||||
name: Build and publish to PyPi and DockerHub
|
||||
deploy_pypi:
|
||||
name: Build and publish to PyPi
|
||||
runs-on: ubuntu-latest
|
||||
needs: [jest, tox]
|
||||
if: github.ref == 'refs/heads/deploy/release'
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
@ -113,30 +111,6 @@ jobs:
|
||||
|
||||
- name: "Build Python package"
|
||||
run: python3 -m build
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: 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: Login to Github Packages
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GHCR_PAT }}
|
||||
|
||||
- name: Build image and push to Docker Hub and GitHub Container Registry
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
tags: jaedb/iris:latest
|
||||
push: ${{ github.ref == 'refs/heads/master' }}
|
||||
|
||||
- name: Publish to Pypi
|
||||
uses: pypa/gh-action-pypi-publish@v1.4.1
|
||||
@ -146,3 +120,32 @@ jobs:
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
|
||||
deploy_image:
|
||||
name: Build and publish to DockerHub
|
||||
runs-on: ubuntu-latest
|
||||
needs: [jest, tox]
|
||||
if: github.ref == 'refs/heads/deploy/release'
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v2
|
||||
with:
|
||||
images: jaedb/iris
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
Reference in New Issue
Block a user