cleanup #32
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: buildx-image | |
on: | |
push: | |
branches: [ "master" ] | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.7" | |
- name: Build Python package | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f bin/requirements.txt ]; then pip install -r bin/requirements.txt; fi | |
rm -fr dist/* | |
python3 setup.py egg_info sdist | |
export version=$(egrep -o "__version__ = \".+\"" ja2mqtt/__init__.py | awk '{print $3}' | sed 's/^.//;s/.$//') | |
echo "image_tag=${version}" >> $GITHUB_ENV | |
mkdir -p docker/files | |
cp dist/*.tar.gz docker/files | |
cp config/sample-config.yaml docker/files | |
cp config/ja2mqtt.yaml docker/files | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: "docker" | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: tomvit/ja2mqtt:latest, tomvit/ja2mqtt:${{ env.image_tag }} |