Skip to content

Commit

Permalink
maybe kick off ci
Browse files Browse the repository at this point in the history
wez committed Jan 3, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
wez Wez Furlong
1 parent 007697f commit fe48789
Showing 4 changed files with 161 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
github: wez
patreon: WezFurlong
ko_fi: wezfurlong
liberapay: wez
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
groups:
all:
patterns:
- "*"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
138 changes: 138 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
on:
pull_request:
branches:
- main
push:
branches:
- main
paths:
- "**/*.rs"
- "addon/**"
- "**/Cargo.*"
- ".github/workflows/build.yml"
- ".cargo/config.toml"
- "build-cross.sh"
- "build-docker.sh"
- "Dockerfile"
- ".dockerignore"

env:
IMAGE: ghcr.io/wez/govee2mqtt

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm/v7
- linux/arm64
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Docker meta
if: ${{ github.event_name != 'pull_request' }}
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
type=ref,event=pr
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
registry: https://ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build executable
run: ./build-cross.sh ${{ matrix.platform }}
- name: Build No Push
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms: ${{ matrix.platform }}
push: false
- name: Build and push by digest
if: ${{ github.event_name != 'pull_request' }}
id: build
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
if: ${{ github.event_name != 'pull_request' }}
id: digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
echo "DIGEST_NAME=$(echo ${{ matrix.platform }} | sed 's,/,-,g')" >> $GITHUB_OUTPUT
- name: Upload digest
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: digest-${{ steps.digest.outputs.DIGEST_NAME }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: read
packages: write
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
pattern: digest-*
merge-multiple: true
path: /tmp/digests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
type=ref,event=pr
- name: Login to GHCR
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
registry: https://ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create \
${{ github.event_name == 'pull_request' && '--dry-run' || '' }} \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.IMAGE }}:${{ steps.meta.outputs.version }}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.8'
services:
pv2mqtt:
image: ghcr.io/wez/govee:latest
image: ghcr.io/wez/govee2mqtt:latest
container_name: govee2mqtt
restart: unless-stopped
env_file:

0 comments on commit fe48789

Please sign in to comment.