diff --git a/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml b/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml index 2407d1f5..1aa78668 100644 --- a/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml +++ b/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml @@ -281,3 +281,11 @@ jobs: with: name: OpenMS-App path: dist + + - name: Upload Artifact as Release Asset + if: github.event_name == 'release' + uses: softprops/action-gh-release@v2 + 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 fb4010c8..3284c10e 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: @@ -186,6 +188,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: @@ -419,3 +429,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@v2 + with: + files: OpenMS-App.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index 7ad5bd5b..9153e87d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -151,14 +151,15 @@ 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 as a ZIP file 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; \ else \ echo "GH_TOKEN is not set, skipping the release asset download."; \ fi + # Run app as container entrypoint. EXPOSE $PORT ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/Dockerfile_simple b/Dockerfile_simple index f63ab258..64c24d16 100644 --- a/Dockerfile_simple +++ b/Dockerfile_simple @@ -97,10 +97,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 actions workflow. +# 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 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; \ else \ echo "GH_TOKEN is not set, skipping the release asset download."; \ fi diff --git a/settings.json b/settings.json index 469a9d85..299200af 100644 --- a/settings.json +++ b/settings.json @@ -16,4 +16,4 @@ "online_deployment": false, "enable_workspaces": true, "test": true -} \ No newline at end of file +}