Skip to content

Update Build and Publish.yml #11

Update Build and Publish.yml

Update Build and Publish.yml #11

name: "Build"
on:
push:
branches: [beta-*.*.*, beta]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# checkout repo
- uses: actions/checkout@v4
# get branch / tag name
- name: Get Branch / Tag Name
id: get_branch
run: |
export BRANCH_NAME=$(if [[ ${GITHUB_REF} =~ "refs/tags/" ]]; then echo ${GITHUB_REF/refs\/tags\//}; else echo ${GITHUB_REF/refs\/heads\//}; fi)
echo $BRANCH_NAME
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
# generate the image tag
- name: Get Image Tag
id: get_tag
run: |
export TARGET_IMAGE_TAG=$(if [ "${BRANCH_NAME}" = "main" ]; then echo "main"; else echo "${BRANCH_NAME}"; fi)
echo $TARGET_IMAGE_TAG
echo "TARGET_IMAGE_TAG=${TARGET_IMAGE_TAG}" >> $GITHUB_ENV
# generate the alternative image tag
- name: Get Alternate Tag
id: get_alt_tag
run: |
export ALT_IMAGE_TAG=$(if [ "${BRANCH_NAME}" = "main" ]; then echo "ubuntu"; else echo "${BRANCH_NAME}-ubuntu"; fi)
echo $ALT_IMAGE_TAG
echo "ALT_IMAGE_TAG=${ALT_IMAGE_TAG}" >> $GITHUB_ENV
publish_test:
needs: build
name: Publish Test Version - ${TARGET_IMAGE_TAG}
if: ${{ env.BRANCH_NAME != 'main' }}

Check failure on line 43 in .github/workflows/Build and Publish.yml

View workflow run for this annotation

GitHub Actions / Build

Invalid workflow file

The workflow is not valid. .github/workflows/Build and Publish.yml (Line: 43, Col: 9): Unrecognized named-value: 'env'. Located at position 1 within expression: env.BRANCH_NAME != 'main' .github/workflows/Build and Publish.yml (Line: 56, Col: 9): Unrecognized named-value: 'env'. Located at position 1 within expression: env.BRANCH_NAME == 'main'
uses: homebridge/.github/.github/workflows/npm-publish.yml@latest
with:
tag: ${TARGET_IMAGE_TAG}
dynamically_adjust_version: true
npm_version_command: 'pre'
pre_id: ${TARGET_IMAGE_TAG}
secrets:
npm_auth_token: ${{ secrets.npm_token }}
publish_release:
needs: build
name: Publish Release Version
if: ${{ env.BRANCH_NAME == 'main' }}
uses: homebridge/.github/.github/workflows/npm-publish.yml@latest
with:
install_cmd: npm ci
secrets:
npm_auth_token: ${{ secrets.npm_token }}