on 609f736 help sign in
helix/.github/workflows/release.yml
171 lines 4.8 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 use-cross: ${{ matrix.cross }}
71 command: test
72 args: --release --locked --target ${{ matrix.target }}
74 - name: Build release binary
75 uses: actions-rs/cargo@v1
76 with:
77 use-cross: ${{ matrix.cross }}
78 command: build
79 args: --release --locked --target ${{ matrix.target }}
81 - name: Strip release binary (linux and macos)
82 if: matrix.build == 'x86_64-linux' || matrix.build == 'x86_64-macos'
83 run: strip "target/${{ matrix.target }}/release/hx"
85 - name: Strip release binary (arm)
86 if: matrix.build == 'aarch64-linux'
87 run: |
88 docker run --rm -v \
89 "$PWD/target:/target:Z" \
90 rustembedded/cross:${{ matrix.target }} \
91 aarch64-linux-gnu-strip \
92 /target/${{ matrix.target }}/release/hx
94 - name: Build archive
95 shell: bash
96 run: |
97 mkdir dist
98 if [ "${{ matrix.os }}" = "windows-2019" ]; then
99 cp "target/${{ matrix.target }}/release/hx.exe" "dist/"
100 else
101 cp "target/${{ matrix.target }}/release/hx" "dist/"
102 fi
103 cp -r runtime dist
105 - uses: actions/upload-artifact@v2.3.1
106 with:
107 name: bins-${{ matrix.build }}
108 path: dist
110 publish:
111 name: Publish
112 needs: [dist]
113 runs-on: ubuntu-latest
114 steps:
115 - name: Checkout sources
116 uses: actions/checkout@v2
117 with:
118 submodules: false
120 - uses: actions/download-artifact@v2
121 # with:
122 # path: dist
123 # - run: ls -al ./dist
124 - run: ls -al bins-*
126 - name: Calculate tag name
127 run: |
128 name=dev
129 if [[ $GITHUB_REF == refs/tags/v* ]]; then
130 name=${GITHUB_REF:10}
131 fi
132 echo ::set-output name=val::$name
133 echo TAG=$name >> $GITHUB_ENV
134 id: tagname
136 - name: Build archive
137 shell: bash
138 run: |
139 set -ex
141 rm -rf tmp
142 mkdir tmp
143 mkdir dist
145 for dir in bins-* ; do
146 platform=${dir#"bins-"}
147 if [[ $platform =~ "windows" ]]; then
148 exe=".exe"
149 fi
150 pkgname=helix-$TAG-$platform
151 mkdir tmp/$pkgname
152 cp LICENSE README.md tmp/$pkgname
153 mv bins-$platform/runtime tmp/$pkgname/
154 mv bins-$platform/hx$exe tmp/$pkgname
155 chmod +x tmp/$pkgname/hx$exe
157 if [ "$exe" = "" ]; then
158 tar cJf dist/$pkgname.tar.xz -C tmp $pkgname
159 else
160 (cd tmp && 7z a -r ../dist/$pkgname.zip $pkgname)
161 fi
162 done
164 - name: Upload binaries to release
165 uses: svenstaro/upload-release-action@v2
166 with:
167 repo_token: ${{ secrets.GITHUB_TOKEN }}
168 file: dist/*
169 file_glob: true
170 tag: ${{ steps.tagname.outputs.val }}
171 overwrite: true