diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..b73235e --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,62 @@ +--- + +name: Docker image build + +on: + push: + paths: + - 'Dockerfile' + - 'version.json' + branches: ['master'] + workflow_dispatch: + pull_request: + paths: + - 'Dockerfile' + - 'version.json' + +jobs: + docker-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - name: get version + id: version + uses: notiz-dev/github-action-json-property@release + with: + path: 'version.json' + prop_path: 'version' + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: ./ + file: Dockerfile + platforms: | + linux/amd64 + linux/arm/v7 + linux/arm64 + build-args: | + VERSION=${{ steps.version.outputs.prop }} + CHANNEL=${{ steps.channel.outputs.prop }} + push: ${{ github.event_name != 'pull_request' }} + tags: | + ${{ secrets.DOCKER_HUB_USER }}/tuya-convert:latest + ${{ secrets.DOCKER_HUB_USER }}/tuya-convert:${{ steps.version.outputs.prop }} + labels: | + maintainer=${{ github.repository_owner }} + org.opencontainers.image.vendor=${{ github.repository_owner }} + org.opencontainers.image.revision=${{ github.sha }} diff --git a/version.json b/version.json new file mode 100644 index 0000000..11a2d85 --- /dev/null +++ b/version.json @@ -0,0 +1,3 @@ +{ + "version": "2.4.5" +}