|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + runs-on: ubuntu-16.04 |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v2 |
| 13 | + - name: Get release version |
| 14 | + run: | |
| 15 | + echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
| 16 | + echo "tag: ${{ env.TAG_NAME }}" |
| 17 | + - name: Install dependencies |
| 18 | + run: sudo apt-get install build-essential bzip2 cmake pkg-config libssl-dev |
| 19 | + # Patchelf in Ubuntu 16.04 cannot patch the syntaxdot binary. |
| 20 | + - name: Build patchelf |
| 21 | + run: | |
| 22 | + wget "https://github.com/NixOS/patchelf/releases/download/0.12/patchelf-0.12.tar.bz2" |
| 23 | + echo "699a31cf52211cf5ad6e35a8801eb637bc7f3c43117140426400d67b7babd792 patchelf-0.12.tar.bz2" | sha256sum -c - |
| 24 | + tar jxf patchelf-0.12.tar.bz2 |
| 25 | + ( cd patchelf-0.12.20200827.8d3a16e && ./configure && make -j4 ) |
| 26 | + - name: Download libtorch |
| 27 | + run: | |
| 28 | + wget "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.8.0%2Bcpu.zip" |
| 29 | + echo "0a0a02d264a68a48cda7a0ff8597c1162916336557e08d26ad6ce906f0c4a35d libtorch-cxx11-abi-shared-with-deps-1.8.0+cpu.zip" | sha256sum -c - |
| 30 | + unzip libtorch-cxx11-abi-shared-with-deps-1.8.0+cpu.zip |
| 31 | + - uses: actions-rs/toolchain@v1 |
| 32 | + with: |
| 33 | + profile: minimal |
| 34 | + toolchain: stable |
| 35 | + override: true |
| 36 | + - uses: actions-rs/cargo@v1 |
| 37 | + with: |
| 38 | + command: build |
| 39 | + args: --release |
| 40 | + - name: Create release archive |
| 41 | + id: create_archive |
| 42 | + run: | |
| 43 | + DIST=syntaxdot-${{ env.TAG_NAME }}-cpu-x86_64-linux-gnu-gcc |
| 44 | + ARCHIVE=${DIST}.tar.gz |
| 45 | + install -Dm755 -t ${DIST} target/release/syntaxdot |
| 46 | + install -Dm755 -t ${DIST} libtorch/lib/*.so* |
| 47 | + patchelf-0.12.20200827.8d3a16e/src/patchelf --set-rpath '$ORIGIN' ${DIST}/*.so* ${DIST}/syntaxdot |
| 48 | + tar -czvf ${ARCHIVE} ${DIST} |
| 49 | + echo ::set-output name=ASSET::$ARCHIVE |
| 50 | + |
| 51 | + id: create_release |
| 52 | + env: |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + with: |
| 55 | + tag_name: ${{ github.ref }} |
| 56 | + release_name: Release ${{ github.ref }} |
| 57 | + draft: true |
| 58 | + prerelease: false |
| 59 | + |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + with: |
| 63 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 64 | + asset_path: ${{ steps.create_archive.outputs.ASSET }} |
| 65 | + asset_name: ${{ steps.create_archive.outputs.ASSET }} |
| 66 | + asset_content_type: application/gzip |
0 commit comments