Release Photons Arranger #28
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 | |
name: Release Photons Arranger | |
jobs: | |
build: | |
name: Create the package | |
runs-on: ubuntu-latest | |
environment: github_release | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '17' | |
- id: build_assets | |
run: | | |
set -e | |
rm -rf arranger/static/dist/prod | |
python3 -m venv /tmp/photons | |
/tmp/photons/bin/python -m pip install -e modules | |
/tmp/photons/bin/python -m pip install -e apps/arranger | |
export NODE_OPTIONS=--openssl-legacy-provider | |
export NODE_ENV=production | |
/tmp/photons/bin/lifx arranger_assets static | |
if ! ls apps/arranger/arranger/static/dist/prod/static/*.js > /dev/null; then | |
ls -R apps/arranger/arranger/static/dist/prod | |
echo "Couldn't find any javascript!" | |
exit 1 | |
fi | |
- id: see_built_assets | |
run: ls -R apps/arranger/arranger/static/dist | |
- id: build | |
run: cd apps/arranger && pip install hatch==1.6.3 && hatch build | |
- id: version | |
run: | | |
VERSION=$(python -c "import runpy; print(runpy.run_path('apps/arranger/arranger/__init__.py')['VERSION'])") | |
VERSIONDASH=$(python -c "import runpy; print(runpy.run_path('apps/arranger/arranger/__init__.py')['VERSION'].replace('.', '-'))") | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "versiondash=$VERSIONDASH" >> $GITHUB_OUTPUT | |
- id: package | |
run: > | |
echo "package=lifx_photons_arranger-${{ steps.version.outputs.version}}.tar.gz" >> $GITHUB_OUTPUT | |
- id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "release-arranger-${{ steps.version.outputs.version }}" | |
release_name: Photons Arranger ${{ steps.version.outputs.version }} | |
body: "https://photons.delfick.com/apps/arranger/index.html#release-arranger-${{ steps.version.outputs.versiondash }}" | |
draft: false | |
prerelease: false | |
- id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "apps/arranger/dist/${{ steps.package.outputs.package }}" | |
asset_name: ${{ steps.package.outputs.package }} | |
asset_content_type: application/tar+gzip | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN_ARRANGER }} | |
packages_dir: apps/arranger/dist |