Register Deploy workflow by running it once with no credentials (see … #3
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 to DockerHub | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
docker_username: | |
description: 'DockerHub Username' | |
required: true | |
type: string | |
# TODO ask admins to configure GitHub Secrets | |
docker_password: | |
description: 'DockerHub Password' | |
required: true | |
type: string | |
image_tag: | |
description: 'Docker Image Tag' | |
required: true | |
type: string | |
jobs: | |
dockerhub-deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [linux/amd64, linux/arm64] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build Docker image | |
run: | | |
docker buildx build --load \ | |
--platform ${{ matrix.platform }} \ | |
-t cfpq/py_algo:tmp \ | |
. | |
- name: Run tests | |
run: | | |
docker run --rm \ | |
cfpq/py_algo:tmp -c " | |
echo 'System Info:'; | |
uname -a; | |
pytest test -v -m 'CI'" | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ github.event.inputs.docker_username }} | |
password: ${{ github.event.inputs.docker_password }} | |
- name: Push Docker image | |
run: | | |
docker buildx build --push \ | |
--platform ${{ matrix.platform }} \ | |
-t cfpq/py_algo:${{ github.event.inputs.image_tag }} \ | |
. |