on 44566ea help sign in
helix/.github/workflows/release.yml
169 lines 4.7 kB history raw
1name: Release
2on:
3 # schedule:
4 # - cron: '0 0 * * *' # midnight UTC
6 push:
7 tags:
8 - 'v[0-9]+.[0-9]+.[0-9]+'
9 ## - release
11jobs:
12 dist:
13 name: Dist
14 runs-on: ${{ matrix.os }}
15 strategy:
16 fail-fast: false # don't fail other jobs if one fails
17 matrix:
18 build: [x86_64-linux, aarch64-linux, x86_64-macos, x86_64-windows] #, x86_64-win-gnu, win32-msvc
19 include:
20 - build: x86_64-linux
21 os: ubuntu-20.04
22 rust: stable
23 target: x86_64-unknown-linux-gnu
24 cross: false
25 - build: aarch64-linux
26 os: ubuntu-20.04
27 rust: stable
28 target: aarch64-unknown-linux-gnu
29 cross: true
30 - build: x86_64-macos
31 os: macos-latest
32 rust: stable
33 target: x86_64-apple-darwin
34 cross: false
35 - build: x86_64-windows
36 os: windows-2019
37 rust: stable
38 target: x86_64-pc-windows-msvc
39 cross: false
40 # - build: aarch64-macos
41 # os: macos-latest
42 # rust: stable
43 # target: aarch64-apple-darwin
44 # - build: x86_64-win-gnu
45 # os: windows-2019
46 # rust: stable-x86_64-gnu
47 # target: x86_64-pc-windows-gnu
48 # - build: win32-msvc
49 # os: windows-2019
50 # rust: stable
51 # target: i686-pc-windows-msvc
53 steps:
54 - name: Checkout sources
55 uses: actions/checkout@v2
56 with:
57 submodules: true
59 - name: Install ${{ matrix.rust }} toolchain
60 uses: actions-rs/toolchain@v1
61 with:
62 profile: minimal
63 toolchain: ${{ matrix.rust }}
64 target: ${{ matrix.target }}
65 override: true
67 - name: Run cargo test
68 uses: actions-rs/cargo@v1
69 with:
70 command: test
71 args: --release --locked
73 - name: Build release binary
74 uses: actions-rs/cargo@v1
75 with:
76 use-cross: ${{ matrix.cross }}
77 command: build
78 args: --release --locked --target ${{ matrix.target }}
80 - name: Strip release binary (linux and macos)
81 if: matrix.build == 'x86_64-linux' || matrix.build == 'x86_64-macos'
82 run: strip "target/${{ matrix.target }}/release/hx"
84 - name: Strip release binary (arm)
85 if: matrix.build == 'aarch64-linux'
86 run: |
87 docker run --rm -v \
88 "$PWD/target:/target:Z" \
89 rustembedded/cross:${{ matrix.target }} \
90 aarch64-linux-gnu-strip \
91 /target/${{ matrix.target }}/release/hx
93 - name: Build archive
94 shell: bash
95 run: |
96 mkdir dist
97 if [ "${{ matrix.os }}" = "windows-2019" ]; then
98 cp "target/${{ matrix.target }}/release/hx.exe" "dist/"
99 else
100 cp "target/${{ matrix.target }}/release/hx" "dist/"
101 fi
103 - uses: actions/upload-artifact@v2.2.4
104 with:
105 name: bins-${{ matrix.build }}
106 path: dist
108 publish:
109 name: Publish
110 needs: [dist]
111 runs-on: ubuntu-latest
112 steps:
113 - name: Checkout sources
114 uses: actions/checkout@v2
115 with:
116 submodules: false
118 - uses: actions/download-artifact@v2
119 # with:
120 # path: dist
121 # - run: ls -al ./dist
122 - run: ls -al bins-*
124 - name: Calculate tag name
125 run: |
126 name=dev
127 if [[ $GITHUB_REF == refs/tags/v* ]]; then
128 name=${GITHUB_REF:10}
129 fi
130 echo ::set-output name=val::$name
131 echo TAG=$name >> $GITHUB_ENV
132 id: tagname
134 - name: Build archive
135 shell: bash
136 run: |
137 set -ex
139 rm -rf tmp
140 mkdir tmp
141 mkdir dist
143 for dir in bins-* ; do
144 platform=${dir#"bins-"}
145 if [[ $platform =~ "windows" ]]; then
146 exe=".exe"
147 fi
148 pkgname=helix-$TAG-$platform
149 mkdir tmp/$pkgname
150 cp LICENSE README.md tmp/$pkgname
151 cp -r runtime tmp/$pkgname/
152 mv bins-$platform/hx$exe tmp/$pkgname
153 chmod +x tmp/$pkgname/hx$exe
155 if [ "$exe" = "" ]; then
156 tar cJf dist/$pkgname.tar.xz -C tmp $pkgname
157 else
158 (cd tmp && 7z a -r ../dist/$pkgname.zip $pkgname)
159 fi
160 done
162 - name: Upload binaries to release
163 uses: svenstaro/upload-release-action@v2
164 with:
165 repo_token: ${{ secrets.GITHUB_TOKEN }}
166 file: dist/*
167 file_glob: true
168 tag: ${{ steps.tagname.outputs.val }}
169 overwrite: true