-
Notifications
You must be signed in to change notification settings - Fork 5
129 lines (108 loc) · 3.9 KB
/
release-interactor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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 }}