Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Release

Release #191

Workflow file for this run

name: Release
on:
schedule:
- cron: '0 18 * * FRI'
workflow_dispatch:
env:
CI: 'true'
NODE_VERSION: '20.x'
jobs:
validate:
name: πŸ› οΈ Build
runs-on: ubuntu-latest
steps:
- name: ‡️ Checkout
uses: actions/checkout@v4
- name: πŸ— Set up Node
uses: actions/setup-node@v4
with:
node-version: '${{ env.NODE_VERSION }}'
cache: 'npm'
- name: πŸš› Install dependencies
run: npm ci
- name: ✏️ Lint
run: npm run lint
- name: πŸ› οΈ Build
run: npm run build
- name: πŸ”Ž Test
run: npm test
node:
name: πŸš€ Release Node
needs: [validate]
runs-on: ubuntu-latest
outputs:
previous-version: ${{ steps.publish.outputs.previous-version }}
released-version: ${{ steps.publish.outputs.released-version }}
dist-tag: latest
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- name: ‡️ Checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.LERNA_SSH_PRIVATE_KEY }}
- name: πŸ€– Configure Git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Actions [Bot]"
- name: πŸ— Set up Node
uses: actions/setup-node@v4
with:
node-version: '${{ env.NODE_VERSION }}'
cache: 'npm'
registry-url: 'https://registry.npmjs.org/'
- name: πŸš› Install dependencies
run: npm ci
- name: πŸš€ Publish
id: publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "previous-version=$(yq -r '.version' lerna.json)" >> "$GITHUB_OUTPUT"
npm run release
echo "released-version=$(yq -r '.version' lerna.json)" >> "$GITHUB_OUTPUT"
docker:
name: πŸš€ Release Docker
needs: [node]
if: needs.node.outputs.previous-version != needs.node.outputs.released-version
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: ‡️ Checkout
uses: actions/checkout@v4
- name: πŸ— Set up build cache
id: cache
uses: actions/[email protected]
with:
path: /tmp/.docker-cache
key: docker-${{ github.sha }}
restore-keys: |
docker
- name: πŸ— Set up QEMU
uses: docker/[email protected]
- name: πŸ— Set up Docker Buildx
uses: docker/[email protected]
- name: πŸ— Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: ℹ️ Compose build flags
id: flags
run: |
echo "version=${{ needs.node.outputs.released-version }}" >> "$GITHUB_OUTPUT"
echo "matterbridge-version=$(yq -r '.devDependencies.matterbridge' packages/matterbridge-home-assistant/package.json)" >> "$GITHUB_OUTPUT"
- name: πŸš€ Build
uses: docker/[email protected]
with:
push: true
context: packages/matterbridge-home-assistant-docker
cache-from: |
type=local,src=/tmp/.docker-cache
ghcr.io/${{github.repository}}:${{ steps.flags.outputs.version }}
ghcr.io/${{github.repository}}:latest
cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new
tags: |
ghcr.io/${{github.repository}}:${{ steps.flags.outputs.version }}
ghcr.io/${{github.repository}}:latest
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
build-args: |
MATTERBRIDGE_HOME_ASSISTANT_VERSION=${{ steps.flags.outputs.version }}
MATTERBRIDGE_VERSION=${{ steps.flags.outputs.matterbridge-version }}
- name: 🚚 Swap build cache
run: |
rm -rf /tmp/.docker-cache
mv /tmp/.docker-cache-new /tmp/.docker-cache
dispatch:
name: πŸš€ Repository Dispatch
needs: [node, docker]
runs-on: ubuntu-latest
if: needs.node.outputs.previous-version != needs.node.outputs.released-version
steps:
- name: πŸš€ Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.ADDON_DISPATCH_TOKEN }}
repository: t0bst4r/matterbridge-home-assistant-addon
event-type: release
client-payload: '{"latest-version": "${{ needs.node.outputs.released-version }}"}'