Bump version to 1.5.0 #79
This file contains hidden or 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 and Publish Docker Images | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - feature/creality-support | |
| tags: | |
| - 'v*' | |
| env: | |
| REGISTRY_GITHUB: ghcr.io | |
| REGISTRY_DOCKERHUB: docker.io | |
| IMAGE_NAME_APP: spoolmansync | |
| IMAGE_NAME_HA: spoolmansync-homeassistant | |
| IMAGE_NAME_ADDON: spoolmansync-addon | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Verify addon version matches package.json | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| APP_VERSION=$(node -p "require('./app/package.json').version") | |
| ADDON_VERSION=$(grep '^version:' spoolmansync-ha-addon/config.yaml | sed 's/version: *"\(.*\)"/\1/') | |
| if [ "$APP_VERSION" != "$ADDON_VERSION" ]; then | |
| echo "::error::Version mismatch! package.json=$APP_VERSION, config.yaml=$ADDON_VERSION" | |
| exit 1 | |
| fi | |
| echo "Versions match: $APP_VERSION" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY_GITHUB }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY_DOCKERHUB }} | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| # Generate tags based on trigger type | |
| - name: Generate Docker tags for app | |
| id: meta-app | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ env.REGISTRY_GITHUB }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME_APP }} | |
| ${{ env.REGISTRY_DOCKERHUB }}/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME_APP }} | |
| tags: | | |
| # Set latest tag for main branch and version tags | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
| # Set version tag (v1.0.0 -> 1.0.0) | |
| type=semver,pattern={{version}} | |
| # Set major.minor tag (v1.0.0 -> 1.0) | |
| type=semver,pattern={{major}}.{{minor}} | |
| # Beta tag for feature branches | |
| type=raw,value=creality-beta,enable=${{ github.ref == 'refs/heads/feature/creality-support' }} | |
| - name: Generate Docker tags for HA | |
| id: meta-ha | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ env.REGISTRY_GITHUB }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME_HA }} | |
| ${{ env.REGISTRY_DOCKERHUB }}/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME_HA }} | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=creality-beta,enable=${{ github.ref == 'refs/heads/feature/creality-support' }} | |
| - name: Generate Docker tags for addon | |
| id: meta-addon | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ env.REGISTRY_GITHUB }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME_ADDON }} | |
| ${{ env.REGISTRY_DOCKERHUB }}/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME_ADDON }} | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=creality-beta,enable=${{ github.ref == 'refs/heads/feature/creality-support' }} | |
| # Build and push main app image (multi-arch: amd64 + arm64) | |
| - name: Build and push SpoolmanSync app | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./app | |
| file: ./app/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta-app.outputs.tags }} | |
| labels: ${{ steps.meta-app.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Build and push Home Assistant image (multi-arch: amd64 + arm64) | |
| - name: Build and push SpoolmanSync Home Assistant | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./homeassistant | |
| file: ./homeassistant/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta-ha.outputs.tags }} | |
| labels: ${{ steps.meta-ha.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Build and push HA add-on image (multi-arch: amd64 + arm64) | |
| # Context is repo root since Dockerfile needs both app/ and spoolmansync-ha-addon/rootfs/ | |
| - name: Build and push SpoolmanSync Add-on | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./spoolmansync-ha-addon/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta-addon.outputs.tags }} | |
| labels: ${{ steps.meta-addon.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |