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

gh: Upload Windows build zip to GitHub releases #8787

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 15 additions & 0 deletions .github/scripts/sync-github-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ while [ "${TAG_URL}" != "" ]; do
*)
_asset "otp_win32_${stripped_name}.exe"
_asset "otp_win64_${stripped_name}.exe"
_asset "otp_win32_${stripped_name}.zip"
_asset "otp_win64_${stripped_name}.zip"
;;
esac
fi
Expand Down Expand Up @@ -218,6 +220,9 @@ UPLOADED=false
## Array of all tags that do not have a pre-build
MISSING_PREBUILD=()

## Array of zip files that have been triggered this sync
MISSING_WIN_ZIP=()

_upload_artifacts() {
local name=${1};
local stripped_name=""
Expand All @@ -235,6 +240,14 @@ _upload_artifacts() {
"${UPLOAD_URL}?name=${1}" \
--data-binary "@downloads/${1}"
else
## See if we need to trigger any .exe to .zip convertions
if echo "${RI[@]}" | grep "otp_${2}_${stripped_name}.zip" > /dev/null; then
if [ ${#MISSING_WIN_ZIP[@]} -lt 20 ]; then
MISSING_WIN_ZIP=("${MISSING_WIN_ZIP[@]}" "${stripped_name}")
_curl_post "${REPO}/actions/workflows/upload-windows-zip.yaml/dispatches" -d '{"version":"'"${stripped_name}"'", "target":"'"${2}"'"}'
fi
fi
## See if we need to re-build any prebuilds
if echo "${RI[@]}" | grep "${stripped_name}.tar.gz" > /dev/null; then
MISSING_PREBUILD=("${MISSING_PREBUILD[@]}" "${name}")
fi
Expand All @@ -247,6 +260,8 @@ _upload_artifacts() {
_upload "otp_doc_man_${stripped_name}.tar.gz" "application/gzip"
_upload "otp_win32_${stripped_name}.exe" "application/x-msdownload"
_upload "otp_win64_${stripped_name}.exe" "application/x-msdownload"
_upload "otp_win32_${stripped_name}.zip" "win32"
_upload "otp_win64_${stripped_name}.zip" "win64"
wojtekmach marked this conversation as resolved.
Show resolved Hide resolved
}

## Upload all assets for tags
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/upload-windows-zip.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Upload windows .zip

on:
workflow_dispatch:
inputs:
version:
required: true
target:
required: true

## Needed to upload assets to releases
permissions:
contents: write

jobs:
upload-windows-zip:
runs-on: windows-2022
env:
basename: otp_${{ inputs.target }}_${{ inputs.version }}
steps:
- uses: actions/[email protected]

- name: Install OTP
shell: cmd
run: |
curl.exe --fail -Lo otp.exe https://github.com/erlang/otp/releases/download/OTP-${{ inputs.version }}/${{ env.basename }}.exe
otp.exe /S /D=%CD%\${{ env.basename }}

- name: Download vc_redist.exe
shell: bash
run: |
case "${{ inputs.target }}" in
win32)
vc_redist_target=x86
;;
win64)
vc_redist_target=x64
;;
*)
echo "invalid target $target"
exit 1
;;
esac
curl --fail -Lo vc_redist.exe "https://aka.ms/vs/17/release/vc_redist.$vc_redist_target.exe"

- name: Create .zip
shell: pwsh
run: |
$root = Get-Location

cd ${{ env.basename }}
rm bin\erl.ini
wojtekmach marked this conversation as resolved.
Show resolved Hide resolved
rm Install.exe
rm Install.ini
rm Uninstall.exe
$sha256 = Get-FileHash $root\otp.exe -Algorithm SHA256
$sha256.Hash.ToLower() | Out-File -FilePath installer.sha256
cp $root/vc_redist.exe .
cp $root/erts/etc/win32/INSTALL.txt .
Compress-Archive -Path * -DestinationPath $root\${{ env.basename }}.zip

cd $root
Expand-Archive -Path ${{ env.basename }}.zip -DestinationPath .\otp_test
.\otp_test\bin\erl.exe +V

- name: Upload
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload -R $env:GITHUB_REPOSITORY --clobber OTP-${{ inputs.version }} ${{ env.basename }}.zip
10 changes: 10 additions & 0 deletions erts/etc/win32/INSTALL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Welcome to Erlang/OTP!

This Erlang installation requires "Microsoft Visual C++ Redistributable". Unless it is already
present on your system, you can install vc_redist.exe that is included with this installation.
For scripts, CIs, etc you may want to install it in "passive" mode:

.\vc_redist.exe /install /quiet /norestart

For an installation that is more integrated with Windows (Adds Erlang to Start menu, Add/Remove
Programs, etc), download a "Windows installer" from https://www.erlang.org/downloads.