diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a2ccda..53e5b19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,11 @@ on: branches: - master - development + pull_request: + # The branches below must be a subset of the branches above + branches: + - master + - development jobs: build: @@ -17,6 +22,30 @@ jobs: - name: Checkout git repo uses: actions/checkout@v1 + - name: Download macos oxend binaries + if: runner.os == 'macOS' + run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-macos-LATEST.tar.xz + env: + OS: ${{ runner.os }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + + - name: Download windows oxend binaries + if: runner.os == 'Windows' + run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-windows-LATEST.zip + env: + OS: ${{ runner.os }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + + - name: Download linux oxend binaries + if: runner.os == 'Linux' + run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-linux-LATEST.tar.xz + env: + OS: ${{ runner.os }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + # Read node version from `.nvmrc` file - name: Read nvm rc id: nvmrc @@ -30,35 +59,6 @@ jobs: - name: Install dependencies run: npm install - - name: Download oxend binaries - run: ./download-release-bins.sh - env: - OS: ${{ runner.os }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - shell: bash - working-directory: ./downloads - - - name: Extract zip binaries - if: runner.os == 'Windows' - run: unzip latest - shell: bash - working-directory: ./downloads - - - name: Extract xz binaries - if: runner.os != 'Windows' - run: tar -xf latest - shell: bash - working-directory: ./downloads - - - name: Move oxend binaries - run: | - find ./downloads -type f -name "oxend*" -exec cp '{}' ./bin \; - find ./downloads -type f -name "oxen-wallet-rpc*" -exec cp '{}' ./bin \; - shell: bash - - - name: Verify binaries - run: ls ./bin - shell: bash - name: Build window and linux binaries if: runner.os != 'macOS' diff --git a/.github/workflows/dev-bins-build.yml b/.github/workflows/dev-bins-build.yml index 5f019f8..985b1cb 100644 --- a/.github/workflows/dev-bins-build.yml +++ b/.github/workflows/dev-bins-build.yml @@ -16,6 +16,30 @@ jobs: - name: Checkout git repo uses: actions/checkout@v1 + - name: Download macos oxend binaries + if: runner.os == 'macOS' + run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-dev-macos-LATEST.tar.xz + env: + OS: ${{ runner.os }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + + - name: Download windows oxend binaries + if: runner.os == 'Windows' + run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-dev-windows-LATEST.zip + env: + OS: ${{ runner.os }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + + - name: Download linux oxend binaries + if: runner.os == 'Linux' + run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-dev-linux-LATEST.tar.xz + env: + OS: ${{ runner.os }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + # Read node version from `.nvmrc` file - name: Read nvm rc id: nvmrc @@ -29,35 +53,6 @@ jobs: - name: Install dependencies run: npm install - - name: Download oxend binaries - run: ./download-dev-bins.sh - env: - OS: ${{ runner.os }} - shell: bash - working-directory: ./downloads - - - name: Extract zip binaries - if: runner.os == 'Windows' - run: unzip latest - shell: bash - working-directory: ./downloads - - - name: Extract xz binaries - if: runner.os != 'Windows' - run: tar -xf latest - shell: bash - working-directory: ./downloads - - - name: Move oxend binaries - run: | - find ./downloads -type f -name "oxend*" -exec cp '{}' ./bin \; - find ./downloads -type f -name "oxen-wallet-rpc*" -exec cp '{}' ./bin \; - shell: bash - - - name: Verify binaries - run: ls ./bin - shell: bash - - name: Build window and linux binaries if: runner.os != 'macOS' run: npm run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b6b001..a0eb834 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,30 @@ jobs: - name: Checkout git repo uses: actions/checkout@v1 + - name: Download macos oxend binaries + if: runner.os == 'macOS' + run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-macos-LATEST.tar.xz + env: + OS: ${{ runner.os }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + + - name: Download windows oxend binaries + if: runner.os == 'Windows' + run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-windows-LATEST.zip + env: + OS: ${{ runner.os }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + + - name: Download linux oxend binaries + if: runner.os == 'Linux' + run: tools/download-oxen-files.sh https://oxen.rocks/oxen-io/oxen-core/oxen-stable-linux-LATEST.tar.xz + env: + OS: ${{ runner.os }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + # Read node version from `.nvmrc` file - name: Read nvm rc id: nvmrc @@ -29,36 +53,6 @@ jobs: - name: Install dependencies run: npm install - - name: Download oxend binaries - run: ./download-release-bins.sh - env: - OS: ${{ runner.os }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - shell: bash - working-directory: ./downloads - - - name: Extract zip binaries - if: runner.os == 'Windows' - run: unzip latest - shell: bash - working-directory: ./downloads - - - name: Extract xz binaries - if: runner.os != 'Windows' - run: tar -xf latest - shell: bash - working-directory: ./downloads - - - name: Move oxend binaries - run: | - find ./downloads -type f -name "oxend*" -exec cp '{}' ./bin \; - find ./downloads -type f -name "oxen-wallet-rpc*" -exec cp '{}' ./bin \; - shell: bash - - - name: Verify binaries - run: ls ./bin - shell: bash - - name: Publish window and linux binaries if: runner.os != 'macOS' run: npm run release diff --git a/tools/download-oxen-files.sh b/tools/download-oxen-files.sh index 4fdb3ba..368dc47 100755 --- a/tools/download-oxen-files.sh +++ b/tools/download-oxen-files.sh @@ -3,14 +3,12 @@ if [ "$#" -ne 1 ] || [[ "$1" != http* ]]; then cat <&2 Usage: $0 URL -- download and extract an oxen-core build (typically from https://oxen.rocks) - Some common URLs: https://oxen.rocks/oxen-io/oxen-core/oxen-stable-linux-LATEST.tar.xz - https://oxen.rocks/oxen-io/oxen-core/oxen-stable-win-LATEST.tar.xz + https://oxen.rocks/oxen-io/oxen-core/oxen-stable-win-LATEST.zip https://oxen.rocks/oxen-io/oxen-core/oxen-stable-macos-LATEST.tar.xz - https://oxen.rocks/oxen-io/oxen-core/oxen-dev-linux-LATEST.tar.xz - https://oxen.rocks/oxen-io/oxen-core/oxen-dev-win-LATEST.tar.xz + https://oxen.rocks/oxen-io/oxen-core/oxen-dev-win-LATEST.zip https://oxen.rocks/oxen-io/oxen-core/oxen-dev-macos-LATEST.tar.xz EOF exit 1 @@ -33,8 +31,19 @@ fi rm -f bin/oxen* -curl -sS "$1" | $tar --strip-components=1 -C bin -xJv --no-anchored oxend oxen-wallet-rpc +if [[ "$1" = *win*.zip ]]; then + tmpzip=$(mktemp XXXXXXXXXXXX.zip) + curl -sSo $tmpzip "$1" + unzip -p $tmpzip '*/oxend.exe' >bin/oxend.exe + unzip -p $tmpzip '*/oxen-wallet-rpc.exe' >bin/oxen-wallet-rpc.exe + rm -f $tmpzip -echo "Checking downloaded versions:" -echo -n "oxend: "; ./bin/oxend --version -echo -n "oxen-wallet-rpc: "; ./bin/oxen-wallet-rpc --version + echo "Extracted:" + ls -l bin/*.exe +else + curl -sS "$1" | $tar --strip-components=1 -C bin -xJv --no-anchored oxend oxen-wallet-rpc + + echo "Checking downloaded versions:" + echo -n "oxend: "; ./bin/oxend --version + echo -n "oxen-wallet-rpc: "; ./bin/oxen-wallet-rpc --version +fi