Add name. #18
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: Upload Python Package | |
on: | |
push: | |
release: | |
types: [published] | |
env: | |
REGISTRY: ghcr.io | |
DOCKER_REGISTRY: docker.io | |
# todo | |
# DOCKER_REGISTRY_USER: pinto0309 | |
DOCKER_REGISTRY_USER: sohma440 | |
IMAGE_NAME: ${{ github.repository }} | |
# IMAGE_NAME: onnx2tf | |
jobs: | |
pypi-deploy: | |
# todo | |
if: ${{ false }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel pipenv | |
- name: Build | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Publish a Python distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
# todo | |
# needs: pypi-deploy | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false # do not cancel even if any platform fails. | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Enable buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Prepare | |
run: | | |
platform=${{ matrix.platform }} | |
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
- name: Log in to the GitHub Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log in to the Docker Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.DOCKER_REGISTRY }} | |
username: ${{ env.DOCKER_REGISTRY_USER }} | |
password: ${{ secrets.DH_ACCESS_TOKEN }} | |
- name: Extract metadata (tags, labels) for Github Container Registory | |
id: meta_gh | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push by digest(Github Container Registory) | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: . | |
platforms: ${{ matrix.platform }} | |
push: true | |
# tags: | | |
# ${{ env.DOCKER_REGISTRY }}/sohma440/onnx2tf:latest | |
# ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest | |
labels: ${{ steps.meta_gh.outputs.labels }} | |
# todo | |
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Export digest(Docker Hub) | |
run: | | |
mkdir -p /tmp/digests | |
digest="${{ steps.build.outputs.digest }}" | |
touch "/tmp/digests/${digest#sha256:}" | |
- name: Upload digest | |
uses: actions/upload-artifact@v4 | |
with: | |
name: digests-${{ env.PLATFORM_PAIR }} | |
path: /tmp/digests/* | |
if-no-files-found: error | |
retention-days: 1 | |
merge: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- name: Download digests | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/digests | |
pattern: digests-* | |
merge-multiple: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Github Container Registory | |
- name: Extract metadata (tags, labels) for Github Container Registory | |
id: meta_gh | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Log in to the GitHub Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create manifest list and push to Docker Hub | |
working-directory: /tmp/digests | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
$(printf '${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *) | |
- name: Inspect image(Github Container Registory) | |
run: | | |
docker buildx imagetools inspect ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta_gh.outputs.version }} | |
# Docker Hub | |
- name: Extract metadata (tags, labels) for Docker Hub | |
id: meta_dh | |
uses: docker/metadata-action@v5 | |
with: | |
# todo | |
images: ${{ env.DOCKER_REGISTRY }}/sohma440/onnx2tf | |
- name: Log in to the Docker Hub | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.DOCKER_REGISTRY }} | |
username: ${{ env.DOCKER_REGISTRY_USER }} | |
password: ${{ secrets.DH_ACCESS_TOKEN }} | |
- name: Create manifest list and push to Docker Hub | |
working-directory: /tmp/digests | |
# todo | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
$(printf '${{ env.DOCKER_REGISTRY }}/sohma440/onnx2tf@sha256:%s ' *) | |
- name: Inspect image(Docker Hub) | |
run: | | |
docker buildx imagetools inspect ${{ env.DOCKER_REGISTRY }}/sohma440/onnx2tf:${{ steps.meta_dh.outputs.version }} |