Skip to content

Commit

Permalink
ci: update pwn.red/pow from actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ginkoid committed Jun 23, 2021
1 parent 7c4a593 commit 377af8c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,17 @@ jobs:
- darwin
- windows
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
path: build
- uses: softprops/action-gh-release@v1
with:
files: '*/redpwnpow-*'
files: build/*/redpwnpow-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: cloudflare
run: >
curl -sSXPUT https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT }}/workers/scripts/pow
-H 'authorization:Bearer ${{ secrets.CLOUDFLARE_TOKEN }}' -Hcontent-type:application/javascript
-d "addEventListener('fetch',e=>e.respondWith(new Response(atob('$(sed "s|VERSION|${GITHUB_REF#refs/tags/}|g" cmd/redpwnpow/run.sh | base64 -w0)'))))"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ redpwnpow is approximately **10x** faster than kCTF's [Python solver](https://gi

## Go module

[Documentation on pkg.go.dev](https://pkg.go.dev/github.com/redpwn/pow)
[![Go Reference](https://pkg.go.dev/badge/github.com/redpwn/pow.svg)](https://pkg.go.dev/github.com/redpwn/pow)

### Challenge example

Expand Down
8 changes: 4 additions & 4 deletions cmd/redpwnpow/run.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
# https://github.com/redpwn/pow/blob/master/cmd/redpwnpow/run.sh

set -e
version=v0.0.3
version=VERSION
challenge=$1
run() {
cache_root=$HOME/.cache/redpwnpow
mkdir -p "$cache_root"
cache_path="$cache_root/redpwnpow-$version"
case $(uname | tr '[:upper:]' '[:lower:]') in
linux*) release=linux-amd64;;
darwin*) release=darwin-amd64;;
msys*|mingw*|cygwin*) release=windows-amd64.exe;;
*) echo unknown operating system >&2; exit 1
esac
cache_root=$HOME/.cache/redpwnpow
mkdir -p "$cache_root"
cache_path=$cache_root/redpwnpow-$version-$release
[ -e "$cache_path" ] || curl -sSfLo "$cache_path" "https://github.com/redpwn/pow/releases/download/$version/redpwnpow-$release" && chmod u+x "$cache_path"
"$cache_path" "$challenge"
}
Expand Down

0 comments on commit 377af8c

Please sign in to comment.