Skip to content

Commit

Permalink
Merge pull request #61 from lwthiker/release_artifacts
Browse files Browse the repository at this point in the history
Add compiled binaries to GitHub releases
  • Loading branch information
lwthiker authored May 14, 2022
2 parents 124f074 + 7167328 commit 3263cd2
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 4 deletions.
36 changes: 35 additions & 1 deletion .github/workflows/build-and-test-make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
branches:
- main
Expand All @@ -23,9 +25,11 @@ jobs:
- os: ubuntu-20.04
capture_interface: eth0
make: make
release_name: x86_64-linux-gnu
- os: macos-11
capture_interface: en0
make: gmake
release_name: x86_64-macos
steps:
- uses: actions/setup-python@v3

Expand Down Expand Up @@ -143,4 +147,34 @@ jobs:
cd tests
# sudo is needed for capturing packets
python_bin=$(which python3)
sudo $python_bin -m pytest . --log-cli-level DEBUG --install-dir ${{ runner.temp}}/install --capture-interface ${{ matrix.capture_interface }}
sudo $python_bin -m pytest . --log-cli-level DEBUG --install-dir ${{ runner.temp }}/install --capture-interface ${{ matrix.capture_interface }}
# If it's a tag, create a release and upload the binaries.
# For that we recompile curl-impersonate statically.
- name: Recompile statically for release assets
if: startsWith(github.ref, 'refs/tags/')
run: |
${{ matrix.make }} chrome-clean
${{ matrix.make }} firefox-clean
rm -Rf ${{ runner.temp }}/install
mkdir ${{ runner.temp }}/install
./configure --prefix=${{ runner.temp }}/install --enable-static
${{ matrix.make }} chrome-build
${{ matrix.make }} chrome-checkbuild
${{ matrix.make }} chrome-install-strip
${{ matrix.make }} firefox-build
${{ matrix.make }} firefox-checkbuild
${{ matrix.make }} firefox-install-strip
- name: Create tar release files
if: startsWith(github.ref, 'refs/tags/')
run: |
cd ${{ runner.temp }}/install/bin
tar -c -z -f ${{ runner.temp }}/curl-impersonate-${{ github.ref_name }}.${{ matrix.release_name }}.tar.gz curl-impersonate-ff curl-impersonate-chrome curl_*
echo "release_file=${{ runner.temp }}/curl-impersonate-${{ github.ref_name }}.${{ matrix.release_name }}.tar.gz" >> $GITHUB_ENV
- name: Upload release files
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.release_file }}
38 changes: 35 additions & 3 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,31 @@ firefox-install: ## Install the Firefox version of curl-impersonate after build
cd $(CURL_VERSION)
$(MAKE) install-exec MAKEFLAGS=
# Wrapper scripts for the Firefox version (e.g. 'curl_ff98')
cp -f $(srcdir)/firefox/curl_ff* @bindir@
install $(srcdir)/firefox/curl_ff* @bindir@
.PHONY: firefox-install

firefox-install-strip: ## Like 'firefox-install', but strip binaries for smaller size
cd $(CURL_VERSION)
$(MAKE) install-exec MAKEFLAGS=
# We could have used 'install-strip' but then the docs would be installed as well.
# Instead strip manually.
strip @bindir@/curl-impersonate-ff
# Wrapper scripts for the Firefox version (e.g. 'curl_ff98')
install $(srcdir)/firefox/curl_ff* @bindir@
.PHONY: firefox-install-strip

firefox-uninstall: ## Uninstall the Firefox version of curl-impersonate after 'make install'
cd $(CURL_VERSION)
$(MAKE) uninstall MAKEFLAGS=
rm -Rf @bindir@/curl_ff*
.PHONY: firefox-uninstall

firefox-clean: ## Clean build artifacts of the Firefox version. Use after re-running './configure'
cd $(CURL_VERSION)
$(MAKE) clean MAKEFLAGS=
rm -f .firefox
.PHONY: firefox-clean

chrome-build: $(CURL_VERSION)/.chrome ## Build the Chrome version of curl-impersonate
cd $(CURL_VERSION)
# Don't pass this Makefile's MAKEFLAGS
Expand All @@ -93,16 +109,32 @@ chrome-install: ## Install the Chrome version of curl-impersonate after build
cd $(CURL_VERSION)
$(MAKE) install-exec MAKEFLAGS=
# Wrapper scripts for the Chrome version (e.g. 'curl_chrome99')
cp -f $(srcdir)/chrome/curl_chrome* $(srcdir)/chrome/curl_edge* $(srcdir)/chrome/curl_safari* @bindir@
install $(srcdir)/chrome/curl_chrome* $(srcdir)/chrome/curl_edge* $(srcdir)/chrome/curl_safari* @bindir@
.PHONY: chrome-install

chrome-install-strip: ## Like 'chrome-install', but strip binaries for smaller size
cd $(CURL_VERSION)
$(MAKE) install-exec MAKEFLAGS=
# We could have used 'install-strip' but then the docs would be installed as well.
# Instead strip manually.
strip @bindir@/curl-impersonate-chrome
# Wrapper scripts for the Chrome version (e.g. 'curl_chrome99')
install $(srcdir)/chrome/curl_chrome* $(srcdir)/chrome/curl_edge* $(srcdir)/chrome/curl_safari* @bindir@
.PHONY: chrome-install-strip

chrome-uninstall: ## Uninstall the Chrome version of curl-impersonate after 'make install'
cd $(CURL_VERSION)
$(MAKE) uninstall MAKEFLAGS=
rm -Rf @bindir@/curl_chrome* @bindir@/curl_edge* @bindir@/curl_safari*
.PHONY: chrome-uninstall

clean: ## Remove build artifacts
chrome-clean: ## Clean build artifacts of the Chrome version. Use after re-running './configure'
cd $(CURL_VERSION)
$(MAKE) clean MAKEFLAGS=
rm -f .chrome
.PHONY: chrome-clean

clean: ## Remove all build artifacts, including dependencies
rm -Rf brotli-$(BROTLI_VERSION).tar.gz brotli-$(BROTLI_VERSION)
rm -Rf $(NSS_VERSION).tar.gz $(NSS_VERSION)
rm -Rf boringssl.zip boringssl
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ See [Advanced usage](#Advanced-usage) for more options.
## Installation
There are two versions of `curl-impersonate` for technical reasons. The **chrome** version is used to impersonate Chrome, Edge and Safari. The **firefox** version is used to impersonate Firefox.

### Pre-compiled binaries
Pre-compiled binaries for Linux and macOS (Intel) are available at the [GitHub releases](https://github.com/lwthiker/curl-impersonate/releases) page.

These binaries are statically compiled with libcurl(-impersonate) for ease of use. If you wish to use libcurl-impersonate, please build from source.

### Building from source
See [INSTALL.md](INSTALL.md).

Expand Down

0 comments on commit 3263cd2

Please sign in to comment.