This commit is contained in:
Koushik Dutta
2023-05-09 09:17:04 -07:00
parent 16445bc38e
commit 212306449b
3 changed files with 53 additions and 40 deletions

View File

@@ -3,12 +3,9 @@ name: Publish Scrypted Docker Image
on:
workflow_dispatch:
inputs:
docker_tag:
description: "Docker Tag"
tag:
description: "The npm tag used to build the Docker image. The tag will be resolved as a specific version on npm, and that will be used to version the docker image."
required: true
package_version:
description: "Package Version"
required: false
release:
types: [published]
@@ -24,14 +21,16 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v3
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: NPM Package Request
id: npm-request
uses: fjogeleit/http-request-action@v1
with:
path: server
url: 'https://registry.npmjs.org/@scrypted/server'
method: 'GET'
- name: Print Version
run: echo "Version ${{ github.event.inputs.package_version || steps.package-version.outputs.current-version }}"
- name: Set NPM Version
id: package-version
run: echo "NPM_VERSION=${{ fromJson(steps.npm-request.outputs.response)['dist-tags'][ github.event.inputs.tag] }}" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -63,20 +62,20 @@ jobs:
platforms: linux/amd64,linux/arm64,linux/armhf
push: true
tags: |
${{ format('koush/scrypted:{0}{1}-v{2}', matrix.BASE, matrix.SUPERVISOR, github.event.inputs.package_version || steps.package-version.outputs.current-version) }}
${{ matrix.BASE == '18-bullseye-full' && matrix.SUPERVISOR == '.s6' && format('koush/scrypted:{0}', github.event.inputs.docker_tag) || '' }}
${{ github.event.inputs.docker_tag == 'latest' && matrix.BASE == '18-bullseye-full' && matrix.SUPERVISOR == '' && 'koush/scrypted:full' || '' }}
${{ github.event.inputs.docker_tag == 'latest' && matrix.BASE == '18-bullseye-lite' && matrix.SUPERVISOR == '' && 'koush/scrypted:lite' || '' }}
${{ github.event.inputs.docker_tag == 'latest' && matrix.BASE == '18-bullseye-thin' && matrix.SUPERVISOR == '' && 'koush/scrypted:thin' || '' }}
${{ github.event.inputs.docker_tag == 'latest' && matrix.BASE == '18-bullseye-lite' && matrix.SUPERVISOR == '.s6' && 'koush/scrypted:lite-s6' || '' }}
${{ github.event.inputs.docker_tag == 'latest' && matrix.BASE == '18-bullseye-thin' && matrix.SUPERVISOR == '.s6' && 'koush/scrypted:thin-s6' || '' }}
${{ format('koush/scrypted:{0}{1}-v{2}', matrix.BASE, matrix.SUPERVISOR, steps.package-version.outputs.NPM_VERSION) }}
${{ matrix.BASE == '18-bullseye-full' && matrix.SUPERVISOR == '.s6' && format('koush/scrypted:{0}', github.event.inputs.tag) || '' }}
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '18-bullseye-full' && matrix.SUPERVISOR == '' && 'koush/scrypted:full' || '' }}
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '18-bullseye-lite' && matrix.SUPERVISOR == '' && 'koush/scrypted:lite' || '' }}
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '18-bullseye-thin' && matrix.SUPERVISOR == '' && 'koush/scrypted:thin' || '' }}
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '18-bullseye-lite' && matrix.SUPERVISOR == '.s6' && 'koush/scrypted:lite-s6' || '' }}
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '18-bullseye-thin' && matrix.SUPERVISOR == '.s6' && 'koush/scrypted:thin-s6' || '' }}
${{ format('ghcr.io/koush/scrypted:{0}{1}-v{2}', matrix.BASE, matrix.SUPERVISOR, github.event.inputs.package_version || steps.package-version.outputs.current-version) }}
${{ matrix.BASE == '18-bullseye-full' && matrix.SUPERVISOR == '.s6' && format('ghcr.io/koush/scrypted:{0}', github.event.inputs.docker_tag) || '' }}
${{ github.event.inputs.docker_tag == 'latest' && matrix.BASE == '18-bullseye-full' && matrix.SUPERVISOR == '' && 'ghcr.io/koush/scrypted:full' || '' }}
${{ github.event.inputs.docker_tag == 'latest' && matrix.BASE == '18-bullseye-lite' && matrix.SUPERVISOR == '' && 'ghcr.io/koush/scrypted:lite' || '' }}
${{ github.event.inputs.docker_tag == 'latest' && matrix.BASE == '18-bullseye-thin' && matrix.SUPERVISOR == '' && 'ghcr.io/koush/scrypted:thin' || '' }}
${{ github.event.inputs.docker_tag == 'latest' && matrix.BASE == '18-bullseye-lite' && matrix.SUPERVISOR == '.s6' && 'ghcr.io/koush/scrypted:lite-s6' || '' }}
${{ github.event.inputs.docker_tag == 'latest' && matrix.BASE == '18-bullseye-thin' && matrix.SUPERVISOR == '.s6' && 'ghcr.io/koush/scrypted:thin-s6' || '' }}
${{ format('ghcr.io/koush/scrypted:{0}{1}-v{2}', matrix.BASE, matrix.SUPERVISOR, steps.package-version.outputs.NPM_VERSION) }}
${{ matrix.BASE == '18-bullseye-full' && matrix.SUPERVISOR == '.s6' && format('ghcr.io/koush/scrypted:{0}', github.event.inputs.tag) || '' }}
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '18-bullseye-full' && matrix.SUPERVISOR == '' && 'ghcr.io/koush/scrypted:full' || '' }}
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '18-bullseye-lite' && matrix.SUPERVISOR == '' && 'ghcr.io/koush/scrypted:lite' || '' }}
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '18-bullseye-thin' && matrix.SUPERVISOR == '' && 'ghcr.io/koush/scrypted:thin' || '' }}
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '18-bullseye-lite' && matrix.SUPERVISOR == '.s6' && 'ghcr.io/koush/scrypted:lite-s6' || '' }}
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '18-bullseye-thin' && matrix.SUPERVISOR == '.s6' && 'ghcr.io/koush/scrypted:thin-s6' || '' }}
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@@ -3,11 +3,14 @@ name: Publish Scrypted Home Assistant Image
on:
workflow_dispatch:
inputs:
npm_tag:
description: "The npm tag used to build the Home Assistant image. The tag will be resolved as a specific version on npm, and that version will be the base Scrypted Docker image."
required: false
docker_tag:
description: "Docker Tag"
required: true
package_version:
description: "Package Version"
description: "The Scrypted Docker image tag used to build the Home Assistant image."
required: false
publish_tag:
description: "The tag for the published Scrypted Home Assistant image. Will use the Scrypted Docker Image tag or resolved npm version if not provided."
required: false
workflow_run:
workflows: ["Publish Scrypted Docker Image"]
@@ -20,17 +23,25 @@ jobs:
if: ${{ !github.event.action || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Check Arguments
if: ${{ (!github.event.inputs.npm_tag && !github.event.inputs.docker_tag) || (github.event.inputs.npm_tag && github.event.inputs.docker_tag) }}
run: exit 1
- name: Check out the repo
uses: actions/checkout@v3
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: NPM Package Request
if: ${{ github.event.inputs.npm_tag }}
id: npm-request
uses: fjogeleit/http-request-action@v1
with:
path: server
url: 'https://registry.npmjs.org/@scrypted/server'
method: 'GET'
- name: Print Version
run: echo "Version ${{ github.event.inputs.package_version || steps.package-version.outputs.current-version }}"
- name: Set NPM Version
if: ${{ github.event.inputs.npm_tag }}
id: package-version
run: echo "NPM_VERSION=${{ fromJson(steps.npm-request.outputs.response)['dist-tags'][ github.event.inputs.npm_tag] }}" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -54,15 +65,17 @@ jobs:
- name: Build and push Home Assistant image
uses: docker/build-push-action@v3
with:
build-args: |
SCRYPTED_BASE_IMAGE_TAG=18-bullseye-full.s6-v${{ github.event.inputs.docker_tag || steps.package-version.outputs.NPM_VERSION }}
context: ha_addon/
file: ha_addon/Dockerfile
platforms: linux/amd64,linux/arm64,linux/armhf
push: true
tags: |
${{ format('koush/scrypted:homeassistant-v{0}', github.event.inputs.package_version || steps.package-version.outputs.current-version) }}
${{ github.event.inputs.docker_tag == 'latest' && 'koush/scrypted:homeassistant' || '' }}
${{ format('koush/scrypted:homeassistant-v{0}', github.event.inputs.publish_tag || github.event.inputs.docker_tag || steps.package-version.outputs.NPM_VERSION) }}
${{ github.event.inputs.tag == 'latest' && 'koush/scrypted:homeassistant' || '' }}
${{ format('ghcr.io/koush/scrypted:homeassistant-v{0}', github.event.inputs.package_version || steps.package-version.outputs.current-version) }}
${{ github.event.inputs.docker_tag == 'latest' && 'ghcr.io/koush/scrypted:homeassistant' || '' }}
${{ format('ghcr.io/koush/scrypted:homeassistant-v{0}', github.event.inputs.publish_tag || github.event.inputs.docker_tag || steps.package-version.outputs.NPM_VERSION) }}
${{ github.event.inputs.tag == 'latest' && 'ghcr.io/koush/scrypted:homeassistant' || '' }}
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@@ -1,6 +1,7 @@
ARG SCRYPTED_BASE_IMAGE_TAG=latest
ARG BASHIO_VERSION=0.14.3
ARG TEMPIO_VERSION=2021.09.0
FROM koush/scrypted:beta
FROM koush/scrypted:${SCRYPTED_BASE_IMAGE_TAG}
ARG BASHIO_VERSION
ARG TEMPIO_VERSION