* Initial MySensors proof of concept module #163
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: Publish | |
env: | |
REGISTRY_IMAGE: psobiech/opengr8on | |
on: | |
push: | |
branches: [ "develop" ] | |
tags: | |
- '*' | |
paths-ignore: | |
- '.github/**' | |
- '**/**.md' | |
- 'docs/**' | |
- 'badges/**' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.sha }} | |
cancel-in-progress: true | |
jobs: | |
testLinux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21.0.2' | |
distribution: 'temurin' | |
cache: maven | |
- name: Test | |
run: mvn -B -T 4 test | |
testWindows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Test | |
run: mvn -B -T 4 test | |
maven: | |
needs: [ testLinux, testWindows ] | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21.0.2' | |
distribution: 'temurin' | |
cache: maven | |
- name: Describe tag | |
id: tag | |
continue-on-error: true | |
run: echo "tag=`echo $(git describe --exact-match --tags --match '[0-9]*.[0-9]*.[0-9]*')`" >> $GITHUB_OUTPUT | |
- name: Adjust maven version | |
if: steps.tag.outputs.tag != '' | |
run: mvn versions:set versions:update-child-modules -DnewVersion=${{ steps.tag.outputs.tag }} -DprocessAllModules | |
- name: Deploy | |
run: mvn -B -T 4 deploy -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN -Dmaven.test.skip=true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Package runtime | |
if: steps.tag.outputs.tag != '' | |
run: | | |
mv modules/vclu/target/vclu-jar-with-dependencies.jar modules/vclu/target/vclu.jar | |
mv modules/client/target/client-jar-with-dependencies.jar modules/client/target/client.jar | |
zip -r runtime-${{ steps.tag.outputs.tag }}.zip ./runtime | |
cd ./runtime && zip -r ../device-interfaces-${{ steps.tag.outputs.tag }}.zip ./device-interfaces | |
- name: Release | |
if: steps.tag.outputs.tag != '' | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
runtime-${{ steps.tag.outputs.tag }}.zip | |
device-interfaces-${{ steps.tag.outputs.tag }}.zip | |
modules/vclu/target/vclu.jar | |
modules/client/target/client.jar | |
- name: Submit Dependency Snapshot | |
if: github.ref == 'refs/heads/develop' | |
uses: advanced-security/maven-dependency-submission-action@v3 | |
docker: | |
needs: [ testLinux ] | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
steps: | |
- name: Prepare | |
run: | | |
platform=${{ matrix.platform }} | |
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup master branch locally | |
continue-on-error: true | |
run: | | |
git fetch origin master:master | |
- name: Setup develop branch locally | |
continue-on-error: true | |
run: | | |
git fetch origin develop:develop | |
- name: Describe tag | |
id: tag | |
continue-on-error: true | |
run: | | |
echo "tag=`echo $(git describe --exact-match --tags --match '[0-9]*.[0-9]*.[0-9]*')`" >> $GITHUB_OUTPUT | |
echo "master_head=`echo $(git branch --points-at HEAD --format='%(refname)' | grep master)`" >> $GITHUB_OUTPUT | |
echo "develop_head=`echo $(git branch --points-at HEAD --format='%(refname)' | grep develop)`" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: ${{ matrix.platform }} | |
- name: Login to Docker Container Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY_IMAGE }}-${{ env.PLATFORM_PAIR }} | |
ghcr.io/${{ env.REGISTRY_IMAGE }}-${{ env.PLATFORM_PAIR }} | |
tags: | | |
type=raw,value=latest,enable=${{ contains(steps.tag.outputs.master_head, 'refs/heads/master') }} | |
type=raw,value=master,enable=${{ contains(steps.tag.outputs.master_head, 'refs/heads/master') }} | |
type=raw,value=edge,enable=${{ contains(steps.tag.outputs.develop_head, 'refs/heads/develop') }} | |
type=raw,value=develop,enable=${{ contains(steps.tag.outputs.develop_head, 'refs/heads/develop') }} | |
type=semver,pattern={{version}},value=${{ steps.tag.outputs.tag }},enable=${{ steps.tag.outputs.tag != '' }} | |
type=semver,pattern={{major}}.{{minor}},value=${{ steps.tag.outputs.tag }},enable=${{ steps.tag.outputs.tag != '' }} | |
type=semver,pattern={{major}},value=${{ steps.tag.outputs.tag }},enable=${{ steps.tag.outputs.tag != '' && !startsWith(steps.tag.outputs.tag, '0.') }} | |
type=pep440,priority=899,pattern={{version}},value=${{ steps.tag.outputs.tag }},enable=${{ steps.tag.outputs.tag != '' }} | |
type=ref,event=branch | |
type=ref,event=pr | |
type=schedule | |
- name: Build and push | |
id: build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
target: app-runtime | |
platforms: ${{ matrix.platform }} | |
provenance: false | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Docker meta | |
id: multimeta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
- name: Build and push multiplatform | |
id: multibuild | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
target: app-runtime | |
platforms: ${{ matrix.platform }} | |
provenance: false | |
push: ${{ github.event_name != 'pull_request' }} | |
labels: ${{ steps.multimeta.outputs.labels }} | |
annotations: ${{ steps.multimeta.outputs.annotations }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true | |
- name: Export digest | |
run: | | |
mkdir -p /tmp/digests | |
digest="${{ steps.multibuild.outputs.digest }}" | |
touch "/tmp/digests/${digest#sha256:}" | |
- name: Upload digest | |
uses: actions/upload-artifact@v4 | |
with: | |
name: digests-${{ github.sha }}-${{ env.PLATFORM_PAIR }} | |
path: /tmp/digests/* | |
if-no-files-found: error | |
retention-days: 1 | |
merge: | |
runs-on: ubuntu-latest | |
needs: [ docker ] | |
steps: | |
- name: Download digests | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/digests | |
pattern: digests-${{ github.sha }}-* | |
merge-multiple: true | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup master branch locally | |
continue-on-error: true | |
run: | | |
git fetch origin master:master | |
- name: Setup develop branch locally | |
continue-on-error: true | |
run: | | |
git fetch origin develop:develop | |
- name: Describe tag | |
id: tag | |
continue-on-error: true | |
run: | | |
echo "tag=`echo $(git describe --exact-match --tags --match '[0-9]*.[0-9]*.[0-9]*')`" >> $GITHUB_OUTPUT | |
echo "master_head=`echo $(git branch --points-at HEAD --format='%(refname)' | grep master)`" >> $GITHUB_OUTPUT | |
echo "develop_head=`echo $(git branch --points-at HEAD --format='%(refname)' | grep develop)`" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: ${{ matrix.platform }} | |
- name: Login to Docker Container Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY_IMAGE }} | |
ghcr.io/${{ env.REGISTRY_IMAGE }} | |
tags: | | |
type=raw,value=latest,enable=${{ contains(steps.tag.outputs.master_head, 'refs/heads/master') }} | |
type=raw,value=master,enable=${{ contains(steps.tag.outputs.master_head, 'refs/heads/master') }} | |
type=raw,value=edge,enable=${{ contains(steps.tag.outputs.develop_head, 'refs/heads/develop') }} | |
type=raw,value=develop,enable=${{ contains(steps.tag.outputs.develop_head, 'refs/heads/develop') }} | |
type=semver,pattern={{version}},value=${{ steps.tag.outputs.tag }},enable=${{ steps.tag.outputs.tag != '' }} | |
type=semver,pattern={{major}}.{{minor}},value=${{ steps.tag.outputs.tag }},enable=${{ steps.tag.outputs.tag != '' }} | |
type=semver,pattern={{major}},value=${{ steps.tag.outputs.tag }},enable=${{ steps.tag.outputs.tag != '' && !startsWith(steps.tag.outputs.tag, '0.') }} | |
type=pep440,priority=899,pattern={{version}},value=${{ steps.tag.outputs.tag }},enable=${{ steps.tag.outputs.tag != '' }} | |
type=ref,event=branch | |
type=ref,event=pr | |
type=schedule | |
- name: Create combined manifest and push | |
continue-on-error: true | |
working-directory: /tmp/digests | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) | |
- name: Inspect image | |
continue-on-error: true | |
run: | | |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} |