Skip to content

Commit

Permalink
Merge pull request onionshare#1779 from onionshare/release-2.6.1
Browse files Browse the repository at this point in the history
Release 2.6.1.dev1
  • Loading branch information
SaptakS authored Nov 29, 2023
2 parents ea076e4 + 77fa29f commit 2a5b75c
Show file tree
Hide file tree
Showing 19 changed files with 1,119 additions and 1,015 deletions.
65 changes: 41 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build
run-name: Build win64, mac (Intel), Snap, and Flatpak 🚀
run-name: Build Windows (x86_64), macOS (Intel), Snap, and Flatpak 🚀
on:
push:
branches:
Expand All @@ -17,10 +17,10 @@ jobs:
- name: Install python
uses: actions/setup-python@v4
with:
python-version: '3.10.11'
python-version: "3.11.6"

- name: Install poetry
run: C:\hostedtoolcache\windows\Python\3.10.11\x64\python -m pip install poetry
run: C:\hostedtoolcache\windows\Python\3.11.6\x64\python -m pip install poetry

- name: Restore cache - poetry
uses: actions/cache@v3
Expand All @@ -31,8 +31,8 @@ jobs:
- name: Install poetry dependencies
run: |
cd desktop
C:\hostedtoolcache\windows\Python\3.10.11\x64\Scripts\poetry install
C:\hostedtoolcache\windows\Python\3.10.11\x64\Scripts\poetry env list --full-path
C:\hostedtoolcache\windows\Python\3.11.6\x64\Scripts\poetry install
C:\hostedtoolcache\windows\Python\3.11.6\x64\Scripts\poetry env list --full-path
- name: Restore cache - tor
uses: actions/cache@v3
Expand All @@ -41,12 +41,13 @@ jobs:
key: ${{ runner.os }}-win64-tor-${{ hashFiles('desktop/scripts/get-tor.py') }}

- name: Get tor binaries from Tor Browser (64-bit)
run: cd desktop && C:\hostedtoolcache\windows\Python\3.10.11\x64\Scripts\poetry run python .\scripts\get-tor.py win64
run: cd desktop && C:\hostedtoolcache\windows\Python\3.11.6\x64\Scripts\poetry run python .\scripts\get-tor.py win64

- name: Install Go >=1.21.1
uses: actions/setup-go@v4
with:
go-version: '>=1.21.1'
go-version: ">=1.21.1"
cache: false
- run: go version

- name: Restore cache - obfs4proxy
Expand Down Expand Up @@ -100,31 +101,28 @@ jobs:
- name: Build OnionShare
run: |
cd desktop
C:\hostedtoolcache\windows\Python\3.10.11\x64\Scripts\poetry run python .\setup-freeze.py build
C:\hostedtoolcache\windows\Python\3.10.11\x64\Scripts\poetry run python .\scripts\build-windows.py cleanup-build
C:\hostedtoolcache\windows\Python\3.11.6\x64\Scripts\poetry run python .\setup-freeze.py build
C:\hostedtoolcache\windows\Python\3.11.6\x64\Scripts\poetry run python .\scripts\build-windows.py cleanup-build
- name: Compress
shell: pwsh
run: |
mv desktop\build\exe.win-amd64-3.10\ ~\onionshare-win64
mv desktop\build\exe.win-amd64-3.11\ ~\onionshare-win64
Compress-Archive -LiteralPath ~\onionshare-win64 -DestinationPath ~\onionshare-win64.zip
- uses: actions/upload-artifact@v3
with:
name: win64-build
path: ~\onionshare-win64.zip

# TODO: Someday, build universal2 mac binaries. Right now it's blocked because Github Actions doesn't support
# M1 Mac VMs: https://github.com/actions/runner-images/issues/2187

build-mac-intel:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- name: Install Python 3.10.9 (universal2)
- name: Install Python 3.11.6 (universal2)
run: |
curl -L https://www.python.org/ftp/python/3.10.9/python-3.10.9-macos11.pkg --output ~/Downloads/python.pkg
curl -L https://www.python.org/ftp/python/3.11.6/python-3.11.6-macos11.pkg --output ~/Downloads/python.pkg
sudo installer -pkg ~/Downloads/python.pkg -target /
- name: Install poetry
Expand All @@ -140,7 +138,7 @@ jobs:
- name: Install poetry dependencies
run: |
cd desktop
/Library/Frameworks/Python.framework/Versions/3.10/bin/poetry install
/Library/Frameworks/Python.framework/Versions/3.11/bin/poetry install
- name: Restore cache - tor
uses: actions/cache@v3
Expand All @@ -151,7 +149,7 @@ jobs:
- name: Get tor binaries from Tor Browser
run: |
cd desktop
/Library/Frameworks/Python.framework/Versions/3.10/bin/poetry run python ./scripts/get-tor.py macos
/Library/Frameworks/Python.framework/Versions/3.11/bin/poetry run python ./scripts/get-tor.py macos
- name: Restore cache - obfs4proxy
uses: actions/cache@v3
Expand Down Expand Up @@ -210,9 +208,10 @@ jobs:
- name: Build OnionShare
run: |
cd desktop
/Library/Frameworks/Python.framework/Versions/3.10/bin/poetry run python ./setup-freeze.py build
/Library/Frameworks/Python.framework/Versions/3.10/bin/poetry run python ./setup-freeze.py bdist_mac
/Library/Frameworks/Python.framework/Versions/3.10/bin/poetry run python ./scripts/build-macos.py cleanup-build
/Library/Frameworks/Python.framework/Versions/3.11/bin/poetry run python ./setup-freeze.py bdist_mac
rm -rf build/OnionShare.app/Contents/Resources/lib
mv build/exe.macosx-10.9-universal2-3.11/lib build/OnionShare.app/Contents/Resources/
/Library/Frameworks/Python.framework/Versions/3.11/bin/poetry run python ./scripts/build-macos.py cleanup-build
- name: Compress
run: |
Expand All @@ -221,7 +220,7 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: mac-build
name: mac-intel-build
path: ~/onionshare-macos-intel.tar.gz

build-flatpak:
Expand All @@ -239,13 +238,13 @@ jobs:
uses: actions/cache@v3
with:
path: flatpak/.flatpak-builder
key: flatpak-.flatpak-builder
key: flatpak-.flatpak-builder-${{ hashFiles('flatpak/org.onionshare.OnionShare.yaml') }}

- name: Restore cache - build
uses: actions/cache@v3
with:
path: flatpak/build
key: flatpak-build
key: flatpak-build-${{ hashFiles('flatpak/org.onionshare.OnionShare.yaml') }}

- name: Flatpak build
run: |
Expand All @@ -263,14 +262,32 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Restore cache - lxd
uses: actions/cache@v3
with:
path: ~/lxd_cache.tar.gz
key: snap-lxd-${{ hashFiles('snap/snapcraft.yaml') }}

- name: Decompress cached content to lxd directory
run: |
if [ -f "~/lxd_cache.tar.gz" ]; then
sudo tar -xzf ~/lxd_cache.tar.gz -C /
fi
- name: Install dependencies
run: |
sudo lxd init --auto
sudo lxc storage list
sudo snap install snapcraft --classic
sudo ufw disable
- name: Build snap
run: sudo snapcraft --use-lxd
run: sudo snapcraft

- name: Compress lxd directory and set proper permissions
run: |
sudo tar -czf ~/lxd_cache.tar.gz /var/snap/lxd/common/lxd/storage-pools/default
sudo chown $USER:$USER ~/lxd_cache.tar.gz
- uses: actions/upload-artifact@v3
with:
Expand Down
File renamed without changes.
90 changes: 62 additions & 28 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,70 +160,104 @@ From https://snapcraft.io/onionshare/releases (you must be logged in), promote t

### Windows release

Set up the packaging environment:

- Install the Windows SDK from here: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ and add `C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool` to the path (you'll need it for `signtool.exe`)
Create a Windows 11 VM, and set it up like this:

- Install [git for Windows](https://git-scm.com/download/win).
- Install the latest version of 3.11 [from python.org](https://www.python.org/downloads/).
- Install [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/), making sure to check "Desktop development with C++".
- Download and install [7-Zip (x64)](https://7-zip.org/). Add `C:\Program Files\7-Zip` to your path.
- Download and install [gpg4win](https://gpg4win.org/). Add `C:\Program Files (x86)\GnuPG\bin` to your path.
- Install the Windows SDK from here: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/.
- Go to https://dotnet.microsoft.com/download/dotnet-framework and download and install .NET Framework 3.5 SP1 Runtime. I downloaded `dotnetfx35.exe`.
- Go to https://wixtoolset.org/releases/ and download and install WiX toolset. I downloaded `wix311.exe`. Add `C:\Program Files (x86)\WiX Toolset v3.11\bin` to the path.
- Go to https://wixtoolset.org/docs/wix3/ and download and install WiX toolset. I downloaded `wix311.exe`. Add `C:\Program Files (x86)\WiX Toolset v3.11\bin` to the path.

Clone the OnionShare git repo and checkout the release tag.

If you've used this git repo for a previous release, clean it up:

- In the `onionshare/desktop` folder, delete `build` and `dist` from the previous build.
- Delete the poetry environment. You can find its name by run `poetry env list`, and then you can delete it with `poetry env remove [ENV_NAME]`.

Install Poetry and deps. Open a Developer PowerShell for VS window, change to the `onionshare` folder, and run:

Github Actions will build the binaries. Find the Github Actions `build` workflow, switch to the summary tab, and download:
```powershell
cd desktop
pip install poetry
poetry install
```

- `build-win32`
- `build-win64`
Github Actions will build the binaries. Find the Github Actions `build` workflow, switch to the summary tab, download `win64-build.zip`, and copy it to the Windows packaging environment.

Extract these files, change to the `desktop` folder, and run:
Extract `win64-build.zip`. Run:

```
poetry run python .\scripts\build-windows.py codesign [onionshare_win32_path] [onionshare_win64_path]
poetry run python .\scripts\build-windows.py package [onionshare_win32_path] [onionshare_win64_path]
poetry run python .\scripts\build-windows.py codesign [path]
poetry run python .\scripts\build-windows.py package [path]
```

This will create:

- `desktop/dist/OnionShare-win32-$VERSION.msi`
- `desktop/dist/OnionShare-win64-$VERSION.msi`

### macOS release

In order to make a universal2 binary, you must run this one a Mac with Apple Silicon. To keep a clean environment, you can use VM.
In order to make a universal2 binary, you must following these instructions using a Mac with Apple Silicon. To keep a clean environment, you can use VM.

Set up the VM like this:

- Install [Homebrew](https://brew.sh/)
- `brew install create-dmg libiodbc`
- Install the latest Python 3.10 from https://www.python.org/downloads/
- Install the latest Python 3.11 from https://www.python.org/downloads/
- Install ARM64 version of Go from https://go.dev/dl/
- Install "Postgres.app with PostgreSQL 14 (Universal)" from https://postgresapp.com/downloads.html (required for cx_Freeze build step)
- Install "Postgres.app with PostgreSQL 14 (Universal)" from https://postgresapp.com/downloads.html

Clone the OnionShare git repo and checkout the release tag.

If you've used this git repo for a previous release, clean it up:

```sh
cd desktop
rm -rf build dist
# Delete the old poetry environment
poetry env remove $(poetry env list | grep "(Activated)" | cut -d" " -f1)
```

Install and build dependencies:

```sh
cd desktop
python3 -m pip install poetry
/Library/Frameworks/Python.framework/Versions/3.10/bin/poetry install
/Library/Frameworks/Python.framework/Versions/3.10/bin/poetry run python ./scripts/get-tor.py macos
/Library/Frameworks/Python.framework/Versions/3.11/bin/poetry install
/Library/Frameworks/Python.framework/Versions/3.11/bin/poetry run python ./scripts/get-tor.py macos
./scripts/build-pt-obfs4proxy.sh
./scripts/build-pt-snowflake.sh
./scripts/build-pt-meek.sh
/Library/Frameworks/Python.framework/Versions/3.10/bin/poetry run python ./setup-freeze.py build
/Library/Frameworks/Python.framework/Versions/3.10/bin/poetry run python ./setup-freeze.py bdist_mac
/Library/Frameworks/Python.framework/Versions/3.10/bin/poetry run python ./scripts/build-macos.py cleanup-build
cd build
tar -czvf ~/onionshare-macos-universal2.tar.gz OnionShare.app
```

Make the Apple Silicon app bundle:

Set up the packaging environment:
```sh
/Library/Frameworks/Python.framework/Versions/3.11/bin/poetry run python ./setup-freeze.py bdist_mac
rm -rf build/OnionShare.app/Contents/Resources/lib
mv build/exe.macosx-10.9-universal2-3.11/lib build/OnionShare.app/Contents/Resources/
/Library/Frameworks/Python.framework/Versions/3.11/bin/poetry run python ./scripts/build-macos.py cleanup-build
```

The Apple Silicon app bundle will be in `build` folder called `OnionShare.app`.

- Install create-dmg: `brew install create-dmg`
Github Actions will build the Intel app bundle. Find the Github Actions `build` workflow, switch to the summary tab, and download the `mac-intel-build` artifact. Extract it, and you'll get the Intel `OnionShare.app` folder.

Github Actions will build the binaries. Find the Github Actions `build` workflow, switch to the summary tab, and download:
Next, merge these two app bundles into a single universal2 app bundle:

- `build-mac`
```sh
poetry run ./scripts/macos-merge-universal.py [intel_app_path] [silicon_app_path] [universal2_app_path]
```

Extract these files, change to the `desktop` folder, and run:
Finally, code sign and package the universal2 app bundle:

```sh
poetry run python ./scripts/build-macos.py codesign [app_path]
poetry run python ./scripts/build-macos.py package [app_path]
poetry run python ./scripts/build-macos.py codesign [universal2_app_path]
poetry run python ./scripts/build-macos.py package [universal2_app_path]
```

The will create `dist/OnionShare-$VERSION.dmg`.
Expand Down
2 changes: 1 addition & 1 deletion cli/onionshare_cli/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.1
2.6.1.dev1
Loading

0 comments on commit 2a5b75c

Please sign in to comment.