Skip to content

bss-soundweb updated to v1.0.2 by Julusian #1400

bss-soundweb updated to v1.0.2 by Julusian

bss-soundweb updated to v1.0.2 by Julusian #1400

Workflow file for this run

name: Update Module
run-name: ${{ github.event.inputs.module-name }} updated to ${{ github.event.inputs.git-ref }} by ${{ github.actor }}
# Controls when the workflow will run
on:
workflow_dispatch:
inputs:
module-name:
type: string
description: Name of the module (eg bmd-atem)
required: true
git-ref:
type: string
description: Git ref to build (tag/commit)
required: true
jobs:
build:
runs-on: ubuntu-latest
# The first stage is to build their module
# Remember that this is running user code, so we need to make sure not to leak any secrets
steps:
- name: Report info
run: |
echo "Updating **${{ github.event.inputs.module-name }}** to ${{ github.event.inputs.git-ref }} :rocket:" >> $GITHUB_STEP_SUMMARY
- name: Clone module
run: |
git clone https://github.com/bitfocus/companion-module-${{ github.event.inputs.module-name }} -b "${{ github.event.inputs.git-ref }}" "${{ github.event.inputs.module-name }}"
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
# TODO - should this be configurable?
node-version: 18.x
- name: Enable corepack
run: |
corepack enable
- name: Collect info
run: |
cd ${{ github.event.inputs.module-name }}
if grep -q "companion-module-your-module-name" "companion/manifest.json"; then
echo "Module manifest contains references to companion-module-your-module-name!"
exit 99
fi
GIT_HASH=$(git rev-parse HEAD)
echo "git-hash=$GIT_HASH" >> $GITHUB_OUTPUT
- name: Prepare module
run: |
cd ${{ github.event.inputs.module-name }}
yarn
# yarn build would be better, but lacks the --if-present property
npm run build --if-present
- name: Package module
run: |
cd ${{ github.event.inputs.module-name }}
yarn companion-module-build
- uses: actions/upload-artifact@v4
with:
name: pkg
path: ${{ github.event.inputs.module-name }}/pkg.tgz
retention-days: 1
commit:
runs-on: ubuntu-latest
needs: build
# The second stage is to commit the module to the repository
# only allow one workflow to run this step at a time
concurrency: add-module-${{ github.ref }}
steps:
- uses: actions/checkout@v4
with:
path: modules
ref: ${{ github.ref_name }}
- uses: actions/download-artifact@v4
with:
name: pkg
- name: Package module
run: |
tar -xvzf pkg.tgz
UPDATE_DATE=$(date +%Y-%m-%d)
# cleanup some junk
rm -Rf pkg/.yarn || true
tee -a pkg/.build-info <<EOF
MODULE_NAME=${{ github.event.inputs.module-name }}
GIT_REF=${{ github.event.inputs.git-ref }}
RUN_URL=https://github.com/bitfocus/companion-bundled-modules/actions/runs/${{ github.run_id }}
UPDATE_DATE=$UPDATE_DATE
EOF
# TODO - verify module looks valid?
rm -Rf modules/${{ github.event.inputs.module-name }} || true
mv pkg modules/${{ github.event.inputs.module-name }}
- name: Commit updated module
uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: modules
commit_message: "update ${{ github.event.inputs.module-name }} to ${{ github.event.inputs.git-ref }}"