Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add installer to release asset issue - #139 #149

Merged
merged 10 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/build-windows-executable-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types: [created]
workflow_dispatch:

env:
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,17 @@ 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.
# 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 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; \
gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \
unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed as the download button expects the zipped asset.

rm /app/OpenMS-App.zip; \
else \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Improved release asset handling.

The update to use gh release download instead of the previous approach is more efficient and follows GitHub CLI best practices for fetching release assets.

Let's confirm the GitHub CLI command is correctly formatted:


🏁 Script executed:

#!/bin/bash
# Verify the `gh release download` command syntax
gh release download --help | grep -E "(-p|--pattern)"

# Check if unzip is available in the base image
apt list --installed | grep unzip || echo "unzip might not be installed in the base image"

Length of output: 525


Release Asset Handling Verified; Ensure 'unzip' is Present
The update using gh release download -p is correctly implemented and aligns with GitHub CLI best practices. However, our verification indicates that the Docker image may not have the unzip utility installed. Please confirm that the base image includes unzip or add an installation step (e.g., via apt-get update && apt-get install -y unzip or an equivalent command) to ensure the asset extraction doesn’t fail at runtime.

echo "GH_TOKEN is not set, skipping the release asset download."; \
fi


# Run app as container entrypoint.
EXPOSE $PORT
ENTRYPOINT ["/app/entrypoint.sh"]
7 changes: 5 additions & 2 deletions Dockerfile_simple
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,17 @@ 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.
# 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 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; \
gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \
unzip /app/OpenMS-App.zip -d /app/OpenMS-App && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See Dockerfile

rm /app/OpenMS-App.zip; \
else \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Improved release asset handling.

The updated approach to download release assets using gh release download improves efficiency and reliability. Unzipping the asset directly in the Dockerfile is also a good practice.

Checking for missing dependencies that might be needed for the unzip operation:


🏁 Script executed:

#!/bin/bash
# Check if unzip is installed in the base image
grep -E "apt-get install.*unzip" Dockerfile_simple || echo "unzip might not be explicitly installed"

# Check the base image for unzip
docker run --rm ubuntu:22.04 which unzip || echo "unzip is not available in the base image by default"

Length of output: 445


Missing unzip Dependency in Base Image

The updated asset download approach using gh release download is efficient and streamlines the process. However, our checks indicate that the unzip utility is not available in the base image by default. To prevent build failures during the asset extraction step, please add an installation step for unzip before the download and unzip operations.

  • Location: Dockerfile_simple (Lines 100-106)
  • Suggestion: Add a command (e.g., for an Ubuntu-based image):
    + RUN apt-get update && apt-get install -y unzip
    before the asset download step.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# 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 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; \
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 \
# Download latest OpenMS App executable for Windows from GitHub Releases
RUN apt-get update && apt-get install -y unzip
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"]

Expand Down
3 changes: 2 additions & 1 deletion settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"tag": "57690c44-d635-43b0-ab43-f8bd3064ca06"
}
},
"online_deployment": false
"online_deployment": false,
"version": "0.0.0"
}