1313name : release
1414on :
1515 push :
16- # Enable when testing release infrastructure on a branch.
17- # branches:
18- # - release-test
16+ # Enable when testing release infrastructure on a branch.
17+ # branches:
18+ # - ag/ release
1919 tags :
20- - ' v [0-9]+.[0-9]+.[0-9]+'
20+ - ' [0-9]+.[0-9]+.[0-9]+'
2121jobs :
2222 create-release :
2323 name : create-release
2424 runs-on : ubuntu-latest
25- # env:
26- # # Set to force version number, e.g., when no tag exists.
27- # ARTIFACT_VERSION : TEST-0.0.2
25+ # env:
26+ # Set to force version number, e.g., when no tag exists.
27+ # RG_VERSION : TEST-0.0.0
2828 steps :
2929 - name : Create artifacts directory
3030 run : mkdir artifacts
3131
3232 - name : Get the release version from the tag
33- if : env.ARTIFACT_VERSION == ''
34- env :
35- ACTIONS_ALLOW_UNSECURE_COMMANDS : true # this is the quick fix because we don't actually log anything secret.
33+ if : env.RG_VERSION == ''
3634 run : |
3735 # Apparently, this is the right way to get a tag name. Really?
3836 #
3937 # See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
40- echo "::set-env name=ARTIFACT_VERSION:: ${GITHUB_REF#refs/tags/}"
41- echo "version is: ${{ env.ARTIFACT_VERSION }}"
38+ echo "RG_VERSION= ${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
39+ echo "version is: ${{ env.RG_VERSION }}"
4240
4341 - name : Create GitHub release
4442 id : release
4543 uses : actions/create-release@v1
4644 env :
4745 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4846 with :
49- tag_name : ${{ env.ARTIFACT_VERSION }}
50- release_name : ${{ env.ARTIFACT_VERSION }}
47+ tag_name : ${{ env.RG_VERSION }}
48+ release_name : ${{ env.RG_VERSION }}
5149
5250 - name : Save release upload URL to artifact
5351 run : echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url
5452
5553 - name : Save version number to artifact
56- run : echo "${{ env.ARTIFACT_VERSION }}" > artifacts/release-version
54+ run : echo "${{ env.RG_VERSION }}" > artifacts/release-version
5755
5856 - name : Upload artifacts
5957 uses : actions/upload-artifact@v1
@@ -75,145 +73,137 @@ jobs:
7573 TARGET_DIR : ./target
7674 # Emit backtraces on panics.
7775 RUST_BACKTRACE : 1
78- BIN_NAME : dua
76+ # Build static releases with PCRE2.
77+ PCRE2_SYS_STATIC : 1
7978 strategy :
8079 matrix :
8180 build : [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc]
82- # build: [linux, macos, win-msvc, win-gnu, win32-msvc]
8381 include :
84- - build : linux
85- os : ubuntu-18.04
86- rust : stable
87- target : x86_64-unknown-linux-musl
88- feature : tui-unix
89- - build : linux-arm
90- os : ubuntu-18.04
91- rust : stable
92- target : arm-unknown-linux-gnueabihf
93- feature : tui-unix
94- - build : macos
95- os : macos-latest
96- rust : stable
97- target : x86_64-apple-darwin
98- feature : tui-unix
99- - build : win-msvc
100- os : windows-2019
101- rust : nightly
102- target : x86_64-pc-windows-msvc
103- feature : tui-crossplatform
104- - build : win-gnu
105- os : windows-2019
106- rust : nightly-x86_64-gnu
107- target : x86_64-pc-windows-gnu
108- feature : tui-crossplatform
109- - build : win32-msvc
110- os : windows-2019
111- rust : nightly
112- target : i686-pc-windows-msvc
113- feature : tui-crossplatform
82+ - build : linux
83+ os : ubuntu-18.04
84+ rust : nightly
85+ target : x86_64-unknown-linux-musl
86+ - build : linux-arm
87+ os : ubuntu-18.04
88+ rust : nightly
89+ target : arm-unknown-linux-gnueabihf
90+ - build : macos
91+ os : macos-latest
92+ rust : nightly
93+ target : x86_64-apple-darwin
94+ - build : win-msvc
95+ os : windows-2019
96+ rust : nightly
97+ target : x86_64-pc-windows-msvc
98+ - build : win-gnu
99+ os : windows-2019
100+ rust : nightly-x86_64-gnu
101+ target : x86_64-pc-windows-gnu
102+ - build : win32-msvc
103+ os : windows-2019
104+ rust : nightly
105+ target : i686-pc-windows-msvc
114106
115107 steps :
116- - name : Checkout repository
117- uses : actions/checkout@v1
118- with :
119- fetch-depth : 1
120-
121- - name : Install packages (Ubuntu)
122- if : matrix.os == 'ubuntu-18.04'
123- run : |
124- ci/ubuntu-install-packages
125-
126- - name : Install packages (macOS)
127- if : matrix.os == 'macos-latest'
128- run : |
129- ci/macos-install-packages
130-
131- - name : Install Rust
132- uses : actions-rs/toolchain@v1
133- with :
134- toolchain : ${{ matrix.rust }}
135- profile : minimal
136- override : true
137- target : ${{ matrix.target }}
138-
139- - name : Use Cross
140- env :
141- ACTIONS_ALLOW_UNSECURE_COMMANDS : true # this is the quick fix because we don't actually log anything secret.
142- run : |
143- # FIXME: to work around bugs in latest cross release, install master.
144- # ME: Still needed? Issue seems closed
145- # See: https://github.com/rust-embedded/cross/issues/357
146- cargo install --git https://github.com/rust-embedded/cross
147- echo "::set-env name=CARGO::cross"
148- echo "::set-env name=TARGET_FLAGS::--target ${{ matrix.target }}"
149- echo "::set-env name=TARGET_DIR::./target/${{ matrix.target }}"
150-
151- - name : Show command used for Cargo
152- run : |
153- echo "cargo command is: ${{ env.CARGO }}"
154- echo "target flag is: ${{ env.TARGET_FLAGS }}"
155- echo "target dir is: ${{ env.TARGET_DIR }}"
156-
157- - name : Get release download URL
158- uses : actions/download-artifact@v1
159- with :
160- name : artifacts
161- path : artifacts
162-
163- - name : Set release upload URL and release version
164- env :
165- ACTIONS_ALLOW_UNSECURE_COMMANDS : true # this is the quick fix because we don't actually log anything secret.
166- shell : bash
167- run : |
168- release_upload_url="$(cat artifacts/release-upload-url)"
169- echo "::set-env name=RELEASE_UPLOAD_URL::$release_upload_url"
170- echo "release upload url: $RELEASE_UPLOAD_URL"
171- release_version="$(cat artifacts/release-version)"
172- echo "::set-env name=RELEASE_VERSION::$release_version"
173- echo "release version: $RELEASE_VERSION"
174-
175- - name : Build release binary
176- run : ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }} --no-default-features --features ${{ matrix.feature }}
177-
178- - name : Strip release binary (linux and macos)
179- if : matrix.build == 'linux' || matrix.build == 'macos'
180- run : strip "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}"
181-
182- - name : Strip release binary (arm)
183- if : matrix.build == 'linux-arm'
184- run : |
185- docker run --rm -v \
186- "$PWD/target:/target:Z" \
187- rustembedded/cross:arm-unknown-linux-gnueabihf \
188- arm-linux-gnueabihf-strip \
189- /target/arm-unknown-linux-gnueabihf/release/${{ env.BIN_NAME }}
190-
191- - name : Build archive
192- shell : bash
193- env :
194- ACTIONS_ALLOW_UNSECURE_COMMANDS : true # this is the quick fix because we don't actually log anything secret.
195- run : |
196- staging="${{ env.BIN_NAME }}-${{ env.RELEASE_VERSION }}-${{ matrix.target }}"
197- mkdir -p "$staging"
198-
199- cp {README.md,LICENSE,CHANGELOG.md} "$staging/"
200-
201- if [ "${{ matrix.os }}" = "windows-2019" ]; then
202- cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe" "$staging/"
203- 7z a "$staging.zip" "$staging"
204- echo "::set-env name=ASSET::$staging.zip"
205- else
206- cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" "$staging/"
207- tar czf "$staging.tar.gz" "$staging"
208- echo "::set-env name=ASSET::$staging.tar.gz"
209- fi
210-
211- - name : Upload release archive
212- 213- env :
214- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
215- with :
216- upload_url : ${{ env.RELEASE_UPLOAD_URL }}
217- asset_path : ${{ env.ASSET }}
218- asset_name : ${{ env.ASSET }}
219- asset_content_type : application/octet-stream
108+ - name : Checkout repository
109+ uses : actions/checkout@v2
110+ with :
111+ fetch-depth : 1
112+
113+ - name : Install packages (Ubuntu)
114+ if : matrix.os == 'ubuntu-18.04'
115+ run : |
116+ ci/ubuntu-install-packages
117+
118+ - name : Install packages (macOS)
119+ if : matrix.os == 'macos-latest'
120+ run : |
121+ ci/macos-install-packages
122+
123+ - name : Install Rust
124+ uses : actions-rs/toolchain@v1
125+ with :
126+ toolchain : ${{ matrix.rust }}
127+ profile : minimal
128+ override : true
129+ target : ${{ matrix.target }}
130+
131+ - name : Use Cross
132+ # if: matrix.os != 'windows-2019'
133+ run : |
134+ cargo install cross
135+ echo "CARGO=cross" >> $GITHUB_ENV
136+ echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
137+ echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
138+
139+ - name : Show command used for Cargo
140+ run : |
141+ echo "cargo command is: ${{ env.CARGO }}"
142+ echo "target flag is: ${{ env.TARGET_FLAGS }}"
143+ echo "target dir is: ${{ env.TARGET_DIR }}"
144+
145+ - name : Get release download URL
146+ uses : actions/download-artifact@v1
147+ with :
148+ name : artifacts
149+ path : artifacts
150+
151+ - name : Set release upload URL and release version
152+ shell : bash
153+ run : |
154+ release_upload_url="$(cat artifacts/release-upload-url)"
155+ echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV
156+ echo "release upload url: $RELEASE_UPLOAD_URL"
157+ release_version="$(cat artifacts/release-version)"
158+ echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
159+ echo "release version: $RELEASE_VERSION"
160+
161+ - name : Build release binary
162+ run : ${{ env.CARGO }} build --verbose --release --features pcre2 ${{ env.TARGET_FLAGS }}
163+
164+ - name : Strip release binary (linux and macos)
165+ if : matrix.build == 'linux' || matrix.build == 'macos'
166+ run : strip "target/${{ matrix.target }}/release/rg"
167+
168+ - name : Strip release binary (arm)
169+ if : matrix.build == 'linux-arm'
170+ run : |
171+ docker run --rm -v \
172+ "$PWD/target:/target:Z" \
173+ rustembedded/cross:arm-unknown-linux-gnueabihf \
174+ arm-linux-gnueabihf-strip \
175+ /target/arm-unknown-linux-gnueabihf/release/rg
176+
177+ - name : Build archive
178+ shell : bash
179+ run : |
180+ outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")"
181+ staging="ripgrep-${{ env.RELEASE_VERSION }}-${{ matrix.target }}"
182+ mkdir -p "$staging"/{complete,doc}
183+
184+ cp {README.md,COPYING,UNLICENSE,LICENSE-MIT} "$staging/"
185+ cp {CHANGELOG.md,FAQ.md,GUIDE.md} "$staging/doc/"
186+ cp "$outdir"/{rg.bash,rg.fish,_rg.ps1} "$staging/complete/"
187+ cp complete/_rg "$staging/complete/"
188+
189+ if [ "${{ matrix.os }}" = "windows-2019" ]; then
190+ cp "target/${{ matrix.target }}/release/rg.exe" "$staging/"
191+ 7z a "$staging.zip" "$staging"
192+ echo "ASSET=$staging.zip" >> $GITHUB_ENV
193+ else
194+ # The man page is only generated on Unix systems. ¯\_(ツ)_/¯
195+ cp "$outdir"/rg.1 "$staging/doc/"
196+ cp "target/${{ matrix.target }}/release/rg" "$staging/"
197+ tar czf "$staging.tar.gz" "$staging"
198+ echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
199+ fi
200+
201+ - name : Upload release archive
202+ 203+ env :
204+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
205+ with :
206+ upload_url : ${{ env.RELEASE_UPLOAD_URL }}
207+ asset_path : ${{ env.ASSET }}
208+ asset_name : ${{ env.ASSET }}
209+ asset_content_type : application/octet-stream
0 commit comments