Skip to content

fix rerun.

fix rerun. #11

Workflow file for this run

name: pypi-and-docker-hub-release
on:
push:
tags:
- "v*"
jobs:
deploy:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
python-version: ["3.12"]
os: [ubuntu-latest]
steps:
- name: Checkout 🔔
uses: actions/checkout@v4
# PyPI release
- name: Setup Python ${{ matrix.python-version }} 🔧
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Python Install dependencies 🧹
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish PyPI 🎁
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload --skip-existing dist/*
- name: Sleep for 60 seconds 💤
run: sleep 60s
shell: bash
# Docker Hub release
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: danishi/dynamodb-csv
- name: Log in to Docker Hub 🚪
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push to Docker Hub 🎁
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# GitHub Packages release
- name: Set env 🔧
run: |
OWNER=$(echo ${{ github.repository_owner }})
echo "RELEASE_OWNER=$OWNER" >> $GITHUB_ENV
IMAGE=dynamodb-csv
echo "RELEASE_IMAGE=$IMAGE" >> $GITHUB_ENV
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Build 🔨
run: |
docker build -t ghcr.io/${{ env.RELEASE_OWNER }}/${{ env.RELEASE_IMAGE }}:${{ env.RELEASE_VERSION }} .
- name: Login 🚪
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ env.RELEASE_OWNER }} --password-stdin
- name: Push by tag name 🎁
run: |
docker push ghcr.io/${{ env.RELEASE_OWNER }}/${{ env.RELEASE_IMAGE }}:${{ env.RELEASE_VERSION }}
- name: Push by latest 🎁
run: |
docker image tag ghcr.io/${{ env.RELEASE_OWNER }}/${{ env.RELEASE_IMAGE }}:${{ env.RELEASE_VERSION }} ghcr.io/${{ env.RELEASE_OWNER }}/${{ env.RELEASE_IMAGE }}:latest
docker push ghcr.io/${{ env.RELEASE_OWNER }}/${{ env.RELEASE_IMAGE }}:latest