pnh-opencountdown updated to v2.0.1 by thedist #636
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: 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@v3 | |
with: | |
# TODO - should this be configurable? | |
node-version: 18.x | |
- name: Collect info | |
run: | | |
cd ${{ github.event.inputs.module-name }} | |
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@v3 | |
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@v3 | |
with: | |
path: modules | |
ref: ${{ github.ref_name }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: pkg | |
- name: Package module | |
run: | | |
tar -xvzf pkg.tgz | |
UPDATE_DATE=$(date +%Y-%m-%d) | |
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@v4 | |
with: | |
repository: modules | |
commit_message: "update ${{ github.event.inputs.module-name }} to ${{ github.event.inputs.git-ref }}" |