From 33aa04ce78d40cef1943b9371d77593c7838f34b Mon Sep 17 00:00:00 2001 From: Srajal Dwivedi Date: Tue, 4 Mar 2025 08:43:41 +0530 Subject: [PATCH 1/8] Added installer as a release asset #139 --- .../build-windows-executable-app.yaml | 10 ++++++++ Dockerfile | 24 +++++++++++-------- Dockerfile_simple | 22 +++++++++-------- settings.json | 3 ++- 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-windows-executable-app.yaml b/.github/workflows/build-windows-executable-app.yaml index cebe29c2..1c131d72 100644 --- a/.github/workflows/build-windows-executable-app.yaml +++ b/.github/workflows/build-windows-executable-app.yaml @@ -4,6 +4,8 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + release: + types: [created] workflow_dispatch: env: @@ -175,6 +177,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Set Version in settings.json + run: | + $VERSION="${{ github.event.release.tag_name }}" + $content = Get-Content -Raw settings.json | ConvertFrom-Json + $content.version = $VERSION + $content | ConvertTo-Json -Depth 100 | Set-Content settings.json + + - name: Download package as artifact uses: actions/download-artifact@v4 with: diff --git a/Dockerfile b/Dockerfile index 7ad5bd5b..60e6cec8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -148,16 +148,20 @@ RUN chmod +x /app/entrypoint.sh # Patch Analytics RUN mamba run -n streamlit-env python hooks/hook-analytics.py -# Set Online Deployment -RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json - -# Download latest OpenMS App executable for Windows from Github actions workflow. -RUN if [ -n "$GH_TOKEN" ]; then \ - echo "GH_TOKEN is set, proceeding to download the release asset..."; \ - gh run download -R ${GITHUB_USER}/${GITHUB_REPO} $(gh run list -R ${GITHUB_USER}/${GITHUB_REPO} -b main -e push -s completed -w "Build executable for Windows" --json databaseId -q '.[0].databaseId') -n OpenMS-App --dir /app; \ - else \ - echo "GH_TOKEN is not set, skipping the release asset download."; \ - fi + +# Set Online Deployment and Version +RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ + jq --arg version "$LATEST_RELEASE" '.online_deployment = true | .version = $version' settings.json > tmp.json && mv tmp.json settings.json + + + +# Download latest OpenMS App installer from GitHub Releases +RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ + DOWNLOAD_URL=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | \ + jq -r '.assets[] | select(.name | endswith("OpenMS-App.zip")) | .browser_download_url') && \ + wget -O /app/OpenMS-App.zip $DOWNLOAD_URL && \ + unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \ + rm /app/OpenMS-App.zip # Run app as container entrypoint. EXPOSE $PORT diff --git a/Dockerfile_simple b/Dockerfile_simple index f63ab258..d9e4e25d 100644 --- a/Dockerfile_simple +++ b/Dockerfile_simple @@ -94,16 +94,18 @@ RUN chmod +x /app/entrypoint.sh # Patch Analytics RUN mamba run -n streamlit-env python hooks/hook-analytics.py -# Set Online Deployment -RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json - -# Download latest OpenMS App executable for Windows from Github actions workflow. -RUN if [ -n "$GH_TOKEN" ]; then \ - echo "GH_TOKEN is set, proceeding to download the release asset..."; \ - gh run download -R ${GITHUB_USER}/${GITHUB_REPO} $(gh run list -R ${GITHUB_USER}/${GITHUB_REPO} -b main -e push -s completed -w "Build executable for Windows" --json databaseId -q '.[0].databaseId') -n OpenMS-App --dir /app; \ - else \ - echo "GH_TOKEN is not set, skipping the release asset download."; \ - fi +# Set Online Deployment and Version +RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ + jq --arg version "$LATEST_RELEASE" '.online_deployment = true | .version = $version' settings.json > tmp.json && mv tmp.json settings.json + + +# Download latest OpenMS App installer from GitHub Releases +RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ + DOWNLOAD_URL=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | \ + jq -r '.assets[] | select(.name | endswith("OpenMS-App.zip")) | .browser_download_url') && \ + wget -O /app/OpenMS-App.zip $DOWNLOAD_URL && \ + unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \ + rm /app/OpenMS-App.zip # make sure that mamba environment is used SHELL ["mamba", "run", "-n", "streamlit-env", "/bin/bash", "-c"] diff --git a/settings.json b/settings.json index a4748fca..30d3d5ce 100644 --- a/settings.json +++ b/settings.json @@ -12,5 +12,6 @@ "tag": "57690c44-d635-43b0-ab43-f8bd3064ca06" } }, - "online_deployment": false + "online_deployment": false, + "version": "0.0.0" } \ No newline at end of file From dc3d146a995dca661c2affea42623bb32c40996b Mon Sep 17 00:00:00 2001 From: Srajal Dwivedi Date: Tue, 4 Mar 2025 08:58:59 +0530 Subject: [PATCH 2/8] docker files updated --- Dockerfile | 10 +++++++--- Dockerfile_simple | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 60e6cec8..8ddc2c57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -156,9 +156,13 @@ RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHU # Download latest OpenMS App installer from GitHub Releases -RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ - DOWNLOAD_URL=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | \ - jq -r '.assets[] | select(.name | endswith("OpenMS-App.zip")) | .browser_download_url') && \ +RUN LATEST_RELEASE=$([ -f /etc/environment ] && source /etc/environment && echo $LATEST_RELEASE || curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ + RESPONSE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest) && \ + DOWNLOAD_URL=$(echo $RESPONSE | jq -r '.assets[] | select(.name | endswith("OpenMS-App.zip")) | .browser_download_url') && \ + if [ -z "$DOWNLOAD_URL" ]; then \ + echo "Error: Could not find OpenMS-App.zip in the latest release assets" && \ + exit 1; \ + fi && \ wget -O /app/OpenMS-App.zip $DOWNLOAD_URL && \ unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \ rm /app/OpenMS-App.zip diff --git a/Dockerfile_simple b/Dockerfile_simple index d9e4e25d..cc5c92b0 100644 --- a/Dockerfile_simple +++ b/Dockerfile_simple @@ -100,9 +100,13 @@ RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHU # Download latest OpenMS App installer from GitHub Releases -RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ - DOWNLOAD_URL=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | \ - jq -r '.assets[] | select(.name | endswith("OpenMS-App.zip")) | .browser_download_url') && \ +RUN LATEST_RELEASE=$([ -f /etc/environment ] && source /etc/environment && echo $LATEST_RELEASE || curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ + RESPONSE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest) && \ + DOWNLOAD_URL=$(echo $RESPONSE | jq -r '.assets[] | select(.name | endswith("OpenMS-App.zip")) | .browser_download_url') && \ + if [ -z "$DOWNLOAD_URL" ]; then \ + echo "Error: Could not find OpenMS-App.zip in the latest release assets" && \ + exit 1; \ + fi && \ wget -O /app/OpenMS-App.zip $DOWNLOAD_URL && \ unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \ rm /app/OpenMS-App.zip From 7771337e9feb1b77fac6aae8c5c4a1c74889e9d3 Mon Sep 17 00:00:00 2001 From: Srajal Dwivedi Date: Wed, 5 Mar 2025 01:10:14 +0530 Subject: [PATCH 3/8] add installer to release docker files updated --- Dockerfile | 29 ++++++++++++----------------- Dockerfile_simple | 27 ++++++++++++--------------- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8ddc2c57..e5a237b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -148,24 +148,19 @@ RUN chmod +x /app/entrypoint.sh # Patch Analytics RUN mamba run -n streamlit-env python hooks/hook-analytics.py +# Set Online Deployment +RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json + +# Download latest OpenMS App executable for Windows from GitHub Releases +RUN if [ -n "$GH_TOKEN" ]; then \ + echo "GH_TOKEN is set, proceeding to download the release asset..."; \ + gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \ + unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \ + rm /app/OpenMS-App.zip; \ + else \ + echo "GH_TOKEN is not set, skipping the release asset download."; \ + fi -# Set Online Deployment and Version -RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ - jq --arg version "$LATEST_RELEASE" '.online_deployment = true | .version = $version' settings.json > tmp.json && mv tmp.json settings.json - - - -# Download latest OpenMS App installer from GitHub Releases -RUN LATEST_RELEASE=$([ -f /etc/environment ] && source /etc/environment && echo $LATEST_RELEASE || curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ - RESPONSE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest) && \ - DOWNLOAD_URL=$(echo $RESPONSE | jq -r '.assets[] | select(.name | endswith("OpenMS-App.zip")) | .browser_download_url') && \ - if [ -z "$DOWNLOAD_URL" ]; then \ - echo "Error: Could not find OpenMS-App.zip in the latest release assets" && \ - exit 1; \ - fi && \ - wget -O /app/OpenMS-App.zip $DOWNLOAD_URL && \ - unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \ - rm /app/OpenMS-App.zip # Run app as container entrypoint. EXPOSE $PORT diff --git a/Dockerfile_simple b/Dockerfile_simple index cc5c92b0..c23fe1e4 100644 --- a/Dockerfile_simple +++ b/Dockerfile_simple @@ -95,21 +95,18 @@ RUN chmod +x /app/entrypoint.sh RUN mamba run -n streamlit-env python hooks/hook-analytics.py # Set Online Deployment and Version -RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ - jq --arg version "$LATEST_RELEASE" '.online_deployment = true | .version = $version' settings.json > tmp.json && mv tmp.json settings.json - - -# Download latest OpenMS App installer from GitHub Releases -RUN LATEST_RELEASE=$([ -f /etc/environment ] && source /etc/environment && echo $LATEST_RELEASE || curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest | jq -r '.tag_name') && \ - RESPONSE=$(curl -s https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/latest) && \ - DOWNLOAD_URL=$(echo $RESPONSE | jq -r '.assets[] | select(.name | endswith("OpenMS-App.zip")) | .browser_download_url') && \ - if [ -z "$DOWNLOAD_URL" ]; then \ - echo "Error: Could not find OpenMS-App.zip in the latest release assets" && \ - exit 1; \ - fi && \ - wget -O /app/OpenMS-App.zip $DOWNLOAD_URL && \ - unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \ - rm /app/OpenMS-App.zip +RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json + +# Download latest OpenMS App executable for Windows from GitHub Releases +RUN if [ -n "$GH_TOKEN" ]; then \ + echo "GH_TOKEN is set, proceeding to download the release asset..."; \ + gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \ + unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \ + rm /app/OpenMS-App.zip; \ + else \ + echo "GH_TOKEN is not set, skipping the release asset download."; \ + fi + # make sure that mamba environment is used SHELL ["mamba", "run", "-n", "streamlit-env", "/bin/bash", "-c"] From 76b5d2d0c90d94bbc6f86e50ff686a77a1668301 Mon Sep 17 00:00:00 2001 From: Srajal Dwivedi Date: Wed, 5 Mar 2025 01:13:51 +0530 Subject: [PATCH 4/8] add installer to release docker files updation --- Dockerfile_simple | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile_simple b/Dockerfile_simple index c23fe1e4..5f2a4e20 100644 --- a/Dockerfile_simple +++ b/Dockerfile_simple @@ -94,7 +94,7 @@ RUN chmod +x /app/entrypoint.sh # Patch Analytics RUN mamba run -n streamlit-env python hooks/hook-analytics.py -# Set Online Deployment and Version +# Set Online Deployment RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json # Download latest OpenMS App executable for Windows from GitHub Releases From f3cd0d82ab1051821bbb7f81357ffbff4678c39c Mon Sep 17 00:00:00 2001 From: Srajal Dwivedi Date: Fri, 7 Mar 2025 00:22:50 +0530 Subject: [PATCH 5/8] updated files for adding installer to release --- .../build-windows-executable-app-with-pyinstaller.yaml | 8 ++++++++ .github/workflows/build-windows-executable-app.yaml | 8 ++++++++ Dockerfile | 4 +--- Dockerfile_simple | 5 +---- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml b/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml index 42646e82..20c8ddb5 100644 --- a/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml +++ b/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml @@ -270,3 +270,11 @@ jobs: with: name: OpenMS-App path: dist + + - name: Upload Artifact as Release Asset + if: github.event_name == 'release' + uses: softprops/action-gh-release@v1 + with: + files: OpenMS-App.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/build-windows-executable-app.yaml b/.github/workflows/build-windows-executable-app.yaml index 1c131d72..2b5181c2 100644 --- a/.github/workflows/build-windows-executable-app.yaml +++ b/.github/workflows/build-windows-executable-app.yaml @@ -418,3 +418,11 @@ jobs: name: OpenMS-App path: | OpenMS-App.zip + + - name: Upload Artifact as Release Asset + if: github.event_name == 'release' + uses: softprops/action-gh-release@v1 + with: + files: OpenMS-App.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index e5a237b9..9153e87d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -151,12 +151,10 @@ RUN mamba run -n streamlit-env python hooks/hook-analytics.py # Set Online Deployment RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json -# Download latest OpenMS App executable for Windows from GitHub Releases +# Download latest OpenMS App executable as a ZIP file RUN if [ -n "$GH_TOKEN" ]; then \ echo "GH_TOKEN is set, proceeding to download the release asset..."; \ gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \ - unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \ - rm /app/OpenMS-App.zip; \ else \ echo "GH_TOKEN is not set, skipping the release asset download."; \ fi diff --git a/Dockerfile_simple b/Dockerfile_simple index 5f2a4e20..64c24d16 100644 --- a/Dockerfile_simple +++ b/Dockerfile_simple @@ -97,17 +97,14 @@ RUN mamba run -n streamlit-env python hooks/hook-analytics.py # Set Online Deployment RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json -# Download latest OpenMS App executable for Windows from GitHub Releases +# Download latest OpenMS App executable as a ZIP file RUN if [ -n "$GH_TOKEN" ]; then \ echo "GH_TOKEN is set, proceeding to download the release asset..."; \ gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \ - unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \ - rm /app/OpenMS-App.zip; \ else \ echo "GH_TOKEN is not set, skipping the release asset download."; \ fi - # make sure that mamba environment is used SHELL ["mamba", "run", "-n", "streamlit-env", "/bin/bash", "-c"] From a6d8ba766fb3aef32009b7eabc73647393638211 Mon Sep 17 00:00:00 2001 From: Srajal Dwivedi Date: Fri, 7 Mar 2025 00:29:54 +0530 Subject: [PATCH 6/8] version updated --- .../build-windows-executable-app-with-pyinstaller.yaml | 2 +- .github/workflows/build-windows-executable-app.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml b/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml index 20c8ddb5..e397af76 100644 --- a/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml +++ b/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml @@ -273,7 +273,7 @@ jobs: - name: Upload Artifact as Release Asset if: github.event_name == 'release' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: OpenMS-App.zip env: diff --git a/.github/workflows/build-windows-executable-app.yaml b/.github/workflows/build-windows-executable-app.yaml index 2b5181c2..e5ae10ad 100644 --- a/.github/workflows/build-windows-executable-app.yaml +++ b/.github/workflows/build-windows-executable-app.yaml @@ -421,7 +421,7 @@ jobs: - name: Upload Artifact as Release Asset if: github.event_name == 'release' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: OpenMS-App.zip env: From 768d25824f1f222db716b0545d5b953cd14ce241 Mon Sep 17 00:00:00 2001 From: Srajal Dwivedi <99940237+Srajald@users.noreply.github.com> Date: Fri, 7 Mar 2025 02:01:36 +0530 Subject: [PATCH 7/8] Update settings.json --- settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.json b/settings.json index 671dde15..1691a1be 100644 --- a/settings.json +++ b/settings.json @@ -14,7 +14,7 @@ } }, "online_deployment": false, - "version": "1.0.2" + "version": "1.0.2", "enable_workspaces": true, "test": true -} \ No newline at end of file +} From e8c14e7fb11103fa1760f99cea9713e3c6322be0 Mon Sep 17 00:00:00 2001 From: Srajal Dwivedi <99940237+Srajald@users.noreply.github.com> Date: Fri, 7 Mar 2025 02:40:18 +0530 Subject: [PATCH 8/8] Updated the release --- settings.json | 1 - 1 file changed, 1 deletion(-) diff --git a/settings.json b/settings.json index 1691a1be..299200af 100644 --- a/settings.json +++ b/settings.json @@ -14,7 +14,6 @@ } }, "online_deployment": false, - "version": "1.0.2", "enable_workspaces": true, "test": true }