Skip to content

Deploy of personal-tuya-devices (all) to beta by @w35l3y #95

Deploy of personal-tuya-devices (all) to beta by @w35l3y

Deploy of personal-tuya-devices (all) to beta by @w35l3y #95

name: call-publish-driver
run-name: Deploy of ${{ inputs.driver }} (${{ inputs.version }}) to ${{ inputs.environment }} by @${{ github.actor }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_call:
inputs:
driver:
description: "Folder name of the driver"
required: true
type: string
version:
description: "Folder name of the version"
required: true
type: string
default: all
environment:
description: Environment
required: true
type: string
default: beta
workflow_dispatch:
inputs:
driver:
description: "Folder name of the driver"
required: true
type: string
version:
description: "Folder name of the version"
required: true
type: string
default: all
environment:
description: Environment
required: true
type: string
default: beta
jobs:
common:
uses: ./.github/workflows/call-update-templates-common.yaml
with:
environment: ${{ inputs.environment }}
secrets: inherit
config:
needs: common
uses: ./.github/workflows/call-update-templates.yaml
with:
driver: personal-tuya-devices
version: ${{ inputs.version }}
environment: ${{ inputs.environment }}
secrets: inherit
test:
uses: ./.github/workflows/call-test-driver.yaml
with:
driver: ${{ inputs.driver }}
version: ${{ inputs.version }}
environment: ${{ inputs.environment }}
secrets: inherit
publish:
needs:
- config
- test
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
strategy:
fail-fast: false
steps:
- name: Check SMARTTHINGS_TOKEN
uses: actions/github-script@v3
env:
VALUE: ${{ secrets.SMARTTHINGS_TOKEN }}
if: env.VALUE == ''
with:
script: |
core.setFailed("Missing secrets.SMARTTHINGS_TOKEN")
- name: Check SMARTTHINGS_CHANNEL
uses: actions/github-script@v3
env:
VALUE: ${{ vars.SMARTTHINGS_CHANNEL }}
if: env.VALUE == ''
with:
script: |
core.setFailed("Missing vars.SMARTTHINGS_CHANNEL")
- uses: actions/checkout@v3
- name: Load node
uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
cache-dependency-path: package-lock.json
- name: Execute helpers
env:
DRIVER_FOLDER: ${{ inputs.driver }}
DRIVER_VERSION: ${{ inputs.version }}
run: |
npm ci
npm start
- name: Remove unwanted files before packaging
working-directory: ${{ inputs.driver }}/src
run: |
find . -name "*.md" -type f -delete
- name: Load SmartThings CLI from cache
uses: actions/cache@v3
id: stcli
with:
path: smartthings
key: stcli-latest
- name: Download SmartThings CLI
if: steps.stcli.outputs.cache-hit != 'true'
run: wget https://github.com/SmartThingsCommunity/smartthings-cli/releases/latest/download/smartthings-linux-x64.tar.gz -O - | tar -xz
- name: Set Environment Variables
run: |
echo "$(pwd)" >> $GITHUB_PATH
- name: Publish
run: smartthings edge:drivers:package ${{ inputs.driver }}/${{ inputs.version }} --channel=${{ vars.SMARTTHINGS_CHANNEL }}
env:
SMARTTHINGS_TOKEN: ${{ secrets.SMARTTHINGS_TOKEN }}