Release Photons Interactor #133
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
on: | |
workflow_dispatch: | |
inputs: | |
skippypi: | |
description: 'Skip making pypi package' | |
default: '0' | |
skipdockermain: | |
description: 'Skip making main docker image' | |
default: '0' | |
name: Release Photons Interactor | |
jobs: | |
interactor_static: | |
runs-on: ubuntu-latest | |
environment: docker | |
defaults: | |
run: | |
working-directory: apps/interactor/interactor_webapp/interactor | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 21.7.3 | |
- name: Install deps | |
shell: bash | |
run: npm ci | |
- name: Build | |
shell: bash | |
run: npm run build | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: webapp | |
path: apps/interactor/interactor_webapp/interactor/build/ | |
build: | |
name: Create the package | |
runs-on: ubuntu-latest | |
environment: docker | |
permissions: | |
# for trusted publishing | |
id-token: write | |
# for creating the release | |
contents: write | |
needs: interactor_static | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download static artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: webapp | |
path: apps/interactor/interactor_webapp/interactor/build/ | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- id: build | |
run: cd apps/interactor && ../../tools/uv build -o dist | |
- id: version | |
run: | | |
VERSION=$(python -c "import runpy; print(runpy.run_path('apps/interactor/interactor/__init__.py')['VERSION'])") | |
VERSIONDASH=$(python -c "import runpy; print(runpy.run_path('apps/interactor/interactor/__init__.py')['VERSION'].replace('.', '-'))") | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "versiondash=$VERSIONDASH" >> $GITHUB_OUTPUT | |
- id: package | |
run: > | |
echo "package=lifx_photons_interactor-${{ steps.version.outputs.version}}.tar.gz" >> $GITHUB_OUTPUT | |
- id: create-release | |
uses: softprops/action-gh-release@v2 | |
if: github.event.inputs.skippypi == '0' | |
with: | |
name: Photons Interactor ${{ steps.version.outputs.version }} | |
body: "https://photons.delfick.com/apps/interactor/changelog.html#release-interactor-${{ steps.version.outputs.versiondash }}" | |
tag_name: "release-interactor-${{ steps.version.outputs.version }}" | |
fail_on_unmatched_files: true | |
draft: false | |
prerelease: false | |
files: "apps/interactor/dist/*" | |
- name: publish | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: github.event.inputs.skippypi == '0' | |
with: | |
packages-dir: apps/interactor/dist | |
- name: Get the docker context | |
env: | |
VERSION: "${{ steps.version.outputs.version }}" | |
run: | | |
set -e | |
mkdir staging | |
cd staging | |
../dev interactor-docker get_docker_context lifx-photons-interactor | |
mv ../apps/interactor/docker/context_lifx-photons-interactor.tar . | |
tar xf context_lifx-photons-interactor.tar | |
rm context_lifx-photons-interactor.tar | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
if: github.event.inputs.skipdockermain == '0' | |
with: | |
context: staging | |
file: ./staging/Dockerfile | |
platforms: linux/arm64,linux/amd64,linux/arm/v7,linux/arm/v6 | |
push: true | |
tags: | | |
${{ github.repository_owner }}/lifx-photons-interactor:latest | |
${{ github.repository_owner }}/lifx-photons-interactor:${{ steps.version.outputs.version }} |