chore(release): prepare for v0.10.6 #11
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
name: Continuous Deployment | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
workflow_dispatch: | |
jobs: | |
generate-changelog: | |
name: Generate changelog | |
runs-on: ubuntu-18.04 | |
outputs: | |
release_body: ${{ steps.release.outputs.release_body }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: Generate a changelog | |
uses: orhun/git-cliff-action@v1 | |
id: git-cliff | |
with: | |
config: cliff.toml | |
args: -vv --latest --strip header | |
env: | |
OUTPUT: CHANGES.md | |
- name: Set the release body | |
id: release | |
shell: bash | |
run: | | |
r=$(cat ${{ steps.git-cliff.outputs.changelog }}) | |
r="$(printf "$r" | tail -n +3)" | |
r="${r//'%'/'%25'}" | |
r="${r//$'\n'/'%0A'}" | |
r="${r//$'\r'/'%0D'}" | |
echo "::set-output name=release_body::$r" | |
publish-github: | |
name: Publish on GitHub | |
needs: generate-changelog | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build: [linux-gnu, linux-musl, macos] | |
include: | |
- BUILD: linux-gnu | |
OS: ubuntu-18.04 | |
TOOLCHAIN: stable | |
TARGET: x86_64-unknown-linux-gnu | |
- BUILD: linux-musl | |
OS: ubuntu-18.04 | |
TOOLCHAIN: stable | |
TARGET: x86_64-unknown-linux-musl | |
- BUILD: macos | |
OS: macos-10.15 | |
TOOLCHAIN: stable | |
TARGET: x86_64-apple-darwin | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Set the release version | |
shell: bash | |
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV | |
- name: Install musl-tools | |
if: matrix.TARGET == 'x86_64-unknown-linux-musl' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
--allow-unauthenticated musl-tools | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.TOOLCHAIN }} | |
target: ${{ matrix.TARGET }} | |
override: true | |
- name: Build | |
run: cargo build --release --target ${{ matrix.TARGET }} | |
- name: Prepare release assets | |
shell: bash | |
run: | | |
mkdir -p release/bin | |
cp {LICENSE*,COPYRIGHT,README.md,CHANGELOG.md} release/ | |
cp -r doc release/doc | |
cp target/${{ matrix.TARGET }}/release/bp7 release/ | |
mv release/ bp7-${{ env.RELEASE_VERSION }}/ | |
- name: Create release artifacts | |
shell: bash | |
run: | | |
tar -czvf bp7-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz \ | |
bp7-${{ env.RELEASE_VERSION }}/ | |
shasum -a 512 bp7-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz \ | |
> bp7-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz.sha512 | |
- name: Upload the release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: bp7-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}* | |
file_glob: true | |
overwrite: true | |
tag: ${{ github.ref }} | |
release_name: "Release v${{ env.RELEASE_VERSION }}" | |
body: "${{ needs.generate-changelog.outputs.release_body }}" | |
publish-crates-io: | |
name: Publish on crates.io | |
needs: publish-github | |
runs-on: ubuntu-18.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Set the release version | |
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV | |
- name: Publish the crate | |
uses: actions-rs/cargo@v1 | |
with: | |
command: publish | |
args: | | |
--allow-dirty --manifest-path Cargo.toml | |
--locked --token ${{ secrets.CARGO_TOKEN }} |