Release v0.3.0 #12
Workflow file for this run
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
# Configuration largely copied from https://github.com/BurntSushi/ripgrep/blob/ffd4c9ccba0ffc74270a8d3ae75f11a7ba7a1a64/.github/workflows/release.yml | |
name: Create Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
create-release: | |
name: create-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create artifacts directory | |
run: mkdir artifacts | |
- name: Get the release version from the tag | |
run: | | |
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 | |
echo "::set-env name=APP_VERSION::${GITHUB_REF#refs/tags/v}" | |
- name: Create GitHub release | |
id: release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.APP_VERSION }} | |
release_name: ${{ env.APP_VERSION }} | |
- name: Save release upload URL to artifact | |
run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url | |
- name: Save version number to artifact | |
run: echo "${{ env.APP_VERSION }}" > artifacts/release-version | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: artifacts | |
path: artifacts | |
build-release: | |
needs: ['create-release'] | |
strategy: | |
fail-fast: false | |
matrix: | |
build: [linux, macos, win-msvc] | |
include: | |
- build: linux | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- build: macos | |
os: macos-latest | |
target: x86_64-apple-darwin | |
- build: win-msvc | |
os: windows-latest | |
target: x86_64-windows-msvc | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Ubuntu dependencies | |
if: matrix.build == 'linux' | |
run: sudo apt-get install -y libdbus-1-dev | |
- uses: actions/checkout@v2 | |
- name: Get release download URL | |
uses: actions/download-artifact@v1 | |
with: | |
name: artifacts | |
path: artifacts | |
- name: Set release upload URL and release version | |
shell: bash | |
run: | | |
release_upload_url="$(cat artifacts/release-upload-url)" | |
echo "::set-env name=RELEASE_UPLOAD_URL::$release_upload_url" | |
echo "release upload url: $RELEASE_UPLOAD_URL" | |
release_version="$(cat artifacts/release-version)" | |
echo "::set-env name=RELEASE_VERSION::$release_version" | |
echo "release version: $RELEASE_VERSION" | |
- name: Build release binary | |
run: cargo build --verbose --release | |
- name: Strip release binary (linux and macos) | |
if: matrix.build == 'linux' || matrix.build == 'macos' | |
run: strip "target/release/buildkite_waiter" | |
- name: Build release archive | |
shell: bash | |
run: | | |
staging="buildkite_waiter-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" | |
mkdir -p "$staging"/complete | |
outdir="$(find target/release -name buildkite_waiter-stamp -print0 \ | |
| xargs -0 ls -t | head -n1 | xargs dirname)" | |
cp {README.md,COPYING,LICENSE-MIT,LICENSE-APACHE,CHANGELOG.md} "$staging/" | |
cp "$outdir"/{buildkite_waiter.bash,buildkite_waiter.fish,_buildkite_waiter,_buildkite_waiter.ps1} "$staging/complete/" | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
cp "target/release/buildkite_waiter.exe" "$staging/" | |
7z a "$staging.zip" "$staging" | |
echo "::set-env name=ASSET::$staging.zip" | |
else | |
cp "target/release/buildkite_waiter" "$staging/" | |
tar czf "$staging.tar.gz" "$staging" | |
echo "::set-env name=ASSET::$staging.tar.gz" | |
fi | |
- name: Upload release archive | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | |
asset_path: ${{ env.ASSET }} | |
asset_name: ${{ env.ASSET }} | |
asset_content_type: application/octet-stream |