Skip to content

curl-impersonate: A special build of curl that can impersonate Chrome & Firefox

Add compiled binaries to GitHub releases

lwthiker5b260dfa3c04
diff --git a/.github/workflows/build-and-test-make.yml b/.github/workflows/build-and-test-make.yml
index cf96dfe..23d439d 100644
--- a/.github/workflows/build-and-test-make.yml
+++ b/.github/workflows/build-and-test-make.yml
@@ -4,6 +4,8 @@ on:
push:
branches:
- main
+ tags:
+ - "v*.*.*"
pull_request:
branches:
- main
@@ -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
@@ -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
+ ${{ matrix.make }} firefox-build
+ ${{ matrix.make }} firefox-checkbuild
+ ${{ matrix.make }} firefox-install
+
+ - 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 }}
diff --git a/Makefile.in b/Makefile.in
index 871c68f..5e6662f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -73,6 +73,11 @@ firefox-uninstall: ## Uninstall the Firefox version of curl-impersonate after 'm
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 .firefox
+
chrome-build: $(CURL_VERSION)/.chrome ## Build the Chrome version of curl-impersonate
cd $(CURL_VERSION)
# Don't pass this Makefile's MAKEFLAGS
@@ -102,7 +107,12 @@ chrome-uninstall: ## Uninstall the Chrome version of curl-impersonate after 'mak
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 .chrome
+
+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