Merge pull request #557 from eval-exec/exec/data2 #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Package | |
concurrency: | |
group: package-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- 'pkg/*' | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: full | |
jobs: | |
create-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set tag | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV | |
- name: Create release | |
id: create-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.GIT_TAG_NAME}} | |
release_name: ${{ env.GIT_TAG_NAME}} | |
draft: true | |
prerelease: true | |
package-for-linux: | |
name: package-for-linux | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set Env | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV | |
- name: Build and package ckb-cli | |
env: | |
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | |
GPG_SIGNER: ${{ secrets.GPG_SIGNER }} | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
docker run --rm -i -w /ckb-cli -v $(pwd):/ckb-cli -e OPENSSL_STATIC=1 $BUILDER_IMAGE make prod | |
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output devtools/ci/signer.asc devtools/ci/signer.asc.gpg | |
gpg --import devtools/ci/signer.asc | |
devtools/ci/package.sh target/release/ckb-cli | |
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} ${{ github.workspace }} | |
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc ${{ github.workspace }} | |
- name: upload-zip-file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
- name: upload-asc-file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
env: | |
BUILDER_IMAGE: nervos/ckb-docker-builder:bionic-rust-1.51.0 | |
REL_PKG: x86_64-unknown-linux-gnu.tar.gz | |
package-for-linux-aarch64: | |
name: package-for-linux-aarch64 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set Env | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV | |
- name: Add rust target | |
run: rustup target add aarch64-unknown-linux-gnu | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y gcc-multilib && sudo apt-get install -y build-essential clang gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
- name: Build and package ckb-cli (aarch64) | |
env: | |
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | |
GPG_SIGNER: ${{ secrets.GPG_SIGNER }} | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
export TOP_DIR=$(pwd) | |
curl -LO https://www.openssl.org/source/openssl-1.1.1.tar.gz | |
tar -xzf openssl-1.1.1.tar.gz | |
cd openssl-1.1.1 | |
CC=aarch64-linux-gnu-gcc ./Configure linux-aarch64 no-shared | |
CC=aarch64-linux-gnu-gcc make | |
cd .. | |
export OPENSSL_LIB_DIR=${TOP_DIR}/openssl-1.1.1 | |
export OPENSSL_INCLUDE_DIR=${TOP_DIR}/openssl-1.1.1/include | |
PKG_CONFIG_ALLOW_CROSS=1 OPENSSL_STATIC=1 CC=gcc CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc cargo build --target=aarch64-unknown-linux-gnu --release | |
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output devtools/ci/signer.asc devtools/ci/signer.asc.gpg | |
gpg --import devtools/ci/signer.asc | |
devtools/ci/package.sh target/aarch64-unknown-linux-gnu/release/ckb-cli | |
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} ${{ github.workspace }} | |
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc ${{ github.workspace }} | |
- name: upload-zip-file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
- name: upload-asc-file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
env: | |
REL_PKG: aarch64-unknown-linux-gnu.tar.gz | |
package-for-centos: | |
name: package-for-centos | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set Env | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV | |
- name: Build and package ckb-cli | |
env: | |
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | |
GPG_SIGNER: ${{ secrets.GPG_SIGNER }} | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
docker run --rm -i -w /ckb-cli -v $(pwd):/ckb-cli $BUILDER_IMAGE make prod | |
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output devtools/ci/signer.asc devtools/ci/signer.asc.gpg | |
gpg --import devtools/ci/signer.asc | |
devtools/ci/package.sh target/release/ckb-cli | |
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} ${{ github.workspace }} | |
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc ${{ github.workspace }} | |
- name: upload-zip-file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
- name: upload-asc-file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
env: | |
BUILDER_IMAGE: nervos/ckb-docker-builder:centos-7-rust-1.51.0 | |
REL_PKG: x86_64-unknown-centos-gnu.tar.gz | |
package-for-mac: | |
name: package-for-mac | |
runs-on: macos-11 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set Env | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV | |
- name: Build and package ckb-cli | |
env: | |
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | |
GPG_SIGNER: ${{ secrets.GPG_SIGNER }} | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
make OPENSSL_STATIC=1 OPENSSL_LIB_DIR=/usr/local/opt/[email protected]/lib OPENSSL_INCLUDE_DIR=/usr/local/opt/[email protected]/include prod | |
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output devtools/ci/signer.asc devtools/ci/signer.asc.gpg | |
gpg --import devtools/ci/signer.asc | |
devtools/ci/package.sh target/release/ckb-cli | |
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} ${{ github.workspace }} | |
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc ${{ github.workspace }} | |
- name: upload-zip-file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
- name: upload-asc-file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
env: | |
REL_PKG: x86_64-apple-darwin.zip | |
package-for-mac-aarch64: | |
name: package-for-mac-aarch64 | |
runs-on: [self-hosted, macOS, ARM64] | |
steps: | |
- name: Setup PATH | |
run: | | |
echo /opt/homebrew/bin >> $GITHUB_PATH | |
echo /opt/homebrew/sbin >> $GITHUB_PATH | |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
- name: Install Depedencies | |
run: | | |
if ! [ -d /opt/homebrew/opt/[email protected] ]; then | |
brew install "[email protected]" | |
fi | |
if ! type -f gpg &> /dev/null; then | |
brew install gnupg | |
fi | |
if ! [ -f "$HOME/.cargo/bin/rustup" ]; then | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
fi | |
- uses: actions/checkout@v2 | |
- name: Set Env | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV | |
- name: Build and package ckb-cli | |
env: | |
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | |
GPG_SIGNER: ${{ secrets.GPG_SIGNER }} | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
make OPENSSL_STATIC=1 OPENSSL_LIB_DIR=/usr/local/opt/[email protected]/lib OPENSSL_INCLUDE_DIR=/usr/local/opt/[email protected]/include prod | |
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output devtools/ci/signer.asc devtools/ci/signer.asc.gpg | |
gpg --import devtools/ci/signer.asc | |
devtools/ci/package.sh target/release/ckb-cli | |
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} ${{ github.workspace }} | |
mv ${{ github.workspace }}/releases/ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc ${{ github.workspace }} | |
- name: upload-zip-file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
- name: upload-asc-file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
env: | |
REL_PKG: aarch64-apple-darwin.zip | |
package-for-windows: | |
name: package-for-windows | |
runs-on: windows-2019 | |
steps: | |
- name: Install Dependencies | |
run: | | |
iwr -useb get.scoop.sh -outfile 'install-scoop.ps1' | |
.\install-scoop.ps1 -RunAsAdmin | |
echo "LIBCLANG_PATH=$($HOME)/scoop/apps/llvm/current/bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo "$env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
scoop install llvm yasm | |
echo ("GIT_TAG_NAME=" + $env:GITHUB_REF.replace('refs/heads/pkg/', '')) >> $env:GITHUB_ENV | |
echo "$env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "LIBCLANG_PATH=$env:USERPROFILE\scoop\apps\llvm\current\bin" >> $env:GITHUB_ENV | |
- uses: actions/checkout@v2 | |
- name: Build | |
run: | | |
make prod | |
- name: Prepare archive | |
run: | | |
$env:GIT_TAG_NAME=($env:GITHUB_REF -split '/')[3] | |
mkdir ckb-cli_$($env:GIT_TAG_NAME)_x86_64-pc-windows-msvc | |
cp -r target/release/ckb-cli.exe,README.md,CHANGELOG.md,COPYING ckb-cli_$($env:GIT_TAG_NAME)_x86_64-pc-windows-msvc | |
- name: Archive Files | |
run: | | |
$env:GIT_TAG_NAME=($env:GITHUB_REF -split '/')[3] | |
Compress-Archive -Path ckb-cli_$($env:GIT_TAG_NAME)_x86_64-pc-windows-msvc -DestinationPath ckb-cli_$($env:GIT_TAG_NAME)_$($env:REL_PKG) | |
- name: Sign Archive | |
env: | |
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | |
GPG_SIGNER: ${{ secrets.GPG_SIGNER }} | |
run: | | |
$CYGPWD = cygpath -u (Get-Location) | |
gpg --quiet --batch --yes --decrypt --passphrase="$env:LARGE_SECRET_PASSPHRASE" --output "$CYGPWD/devtools/ci/signer.asc" "$CYGPWD/devtools/ci/signer.asc.gpg" | |
gpg --import "$CYGPWD/devtools/ci/signer.asc" | |
$env:GIT_TAG_NAME=($env:GITHUB_REF -split '/')[3] | |
gpg -u "$env:GPG_SIGNER" -ab "$CYGPWD/ckb-cli_$($env:GIT_TAG_NAME)_$($env:REL_PKG)" | |
- name: upload-artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }} | |
- name: upload-artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
path: ckb-cli_${{env.GIT_TAG_NAME }}_${{env.REL_PKG }}.asc | |
env: | |
REL_PKG: x86_64-pc-windows-msvc.zip | |
Upload_File: | |
name: Upload_Zip_File | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- REL_PKG: x86_64-unknown-linux-gnu.tar.gz | |
- REL_PKG: aarch64-unknown-linux-gnu.tar.gz | |
- REL_PKG: x86_64-unknown-centos-gnu.tar.gz | |
- REL_PKG: x86_64-apple-darwin.zip | |
- REL_PKG: aarch64-apple-darwin.zip | |
- REL_PKG: x86_64-pc-windows-msvc.zip | |
needs: | |
- create-release | |
- package-for-linux | |
- package-for-linux-aarch64 | |
- package-for-mac | |
- package-for-mac-aarch64 | |
- package-for-windows | |
- package-for-centos | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set tag | |
run: | | |
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' ` | |
echo "GIT_TAG_NAME=$GIT_TAG_NAME" >> $GITHUB_ENV | |
- name: Prepare - Download tar | |
uses: actions/download-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME}}_${{ matrix.REL_PKG }} | |
- name: Prepare - Download asc | |
uses: actions/download-artifact@v2 | |
with: | |
name: ckb-cli_${{env.GIT_TAG_NAME}}_${{ matrix.REL_PKG }}.asc | |
- name: Upload tar assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_name: ckb-cli_${{env.GIT_TAG_NAME}}_${{ matrix.REL_PKG }} | |
asset_path: ${{ github.workspace }}/ckb-cli_${{env.GIT_TAG_NAME }}_${{ matrix.REL_PKG }} | |
asset_content_type: application/octet-stream | |
- name: Upload asc assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_name: ckb-cli_${{env.GIT_TAG_NAME}}_${{ matrix.REL_PKG }}.asc | |
asset_path: ${{ github.workspace }}/ckb-cli_${{env.GIT_TAG_NAME }}_${{ matrix.REL_PKG }}.asc | |
asset_content_type: application/octet-stream |