Merge pull request #147 from Luligu/dev #50
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: Build main and Push Docker image to Docker Hub with buildx | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
- name: Extract version from package.json | |
id: extract_version | |
run: | | |
VERSION=$(jq -r '.version' package.json) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Echo main version ${{ env.VERSION }} | |
run: | | |
echo "Extracted version is: $VERSION ${{ env.VERSION }}" | |
- name: Run Docker Buildx on latest | |
run: | | |
docker buildx build \ | |
--platform linux/amd64,linux/arm64,linux/arm/v7 \ | |
-f docker/Dockerfile.main \ | |
-t luligu/matterbridge:latest \ | |
-t luligu/matterbridge:${{ env.VERSION }} \ | |
--push . | |
docker manifest inspect luligu/matterbridge:latest | |
timeout-minutes: 60 |