You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.8 KiB
YAML
98 lines
2.8 KiB
YAML
name: Release and Docker Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "main"
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: "0 3 1 * *" # Monthly rebuild at 03:00 UTC on the 1st
|
|
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
packages: write
|
|
|
|
jobs:
|
|
release:
|
|
name: Semantic Release
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name != 'schedule'
|
|
outputs:
|
|
release_tag: ${{ steps.get_release.outputs.release_tag }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run semantic-release
|
|
id: semantic
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: npx semantic-release
|
|
|
|
- name: Get latest release tag
|
|
id: get_release
|
|
run: |
|
|
TAG=$(git describe --tags --abbrev=0)
|
|
echo "$TAG" > VERSION
|
|
echo "release_tag=$TAG" >> $GITHUB_OUTPUT
|
|
echo "Found release tag: $TAG"
|
|
|
|
docker:
|
|
name: Build and Push Docker Image
|
|
needs: [release]
|
|
if: github.event_name == 'schedule' || needs.release.result == 'success'
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RELEASE_TAG: ${{ needs.release.outputs.release_tag }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PAT }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push
|
|
id: build-and-push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
sbom: true
|
|
provenance: true
|
|
platforms: linux/arm64,linux/amd64
|
|
tags: |
|
|
graystorm/amcrest2mqtt:latest
|
|
graystorm/amcrest2mqtt:${{ env.RELEASE_TAG }}
|
|
push: true
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
labels: |
|
|
org.opencontainers.image.version=${{ env.RELEASE_TAG }}
|
|
org.opencontainers.image.title=amcrest2mqtt
|
|
org.opencontainers.image.source=${{ github.repository }}
|
|
org.opencontainers.image.authors=weirdTangent <jeff@weirdtangent.com>
|
|
org.opencontainers.image.url=https://www.graystorm.com
|
|
org.opencontainers.image.documentation=https://github.com/${{ github.repository }}#readme
|
|
org.opencontainers.image.description=Publishes Amcrest camera events, snapshots, and status updates via MQTT for Home Assistant auto-discovery
|
|
org.opencontainers.image.licenses=MIT
|