Skip to content

chore(release): prepare for v0.20.0 #18

chore(release): prepare for v0.20.0

chore(release): prepare for v0.20.0 #18

Workflow file for this run

name: Continuous Deployment
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
jobs:
generate-changelog:
name: Generate changelog
runs-on: ubuntu-20.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: [linux64-gnu, linux64-musl, linux-armv7-musl, macos-x64]
include:
- BUILD: linux64-gnu
OS: ubuntu-20.04
TOOLCHAIN: stable
TARGET: x86_64-unknown-linux-gnu
- BUILD: linux64-musl
OS: ubuntu-20.04
TOOLCHAIN: stable
TARGET: x86_64-unknown-linux-musl
CROSS: true
- BUILD: macos-x64
OS: macos-11
TOOLCHAIN: stable
TARGET: x86_64-apple-darwin
- BUILD: linux-armv7-musl
OS: ubuntu-20.04
TOOLCHAIN: stable
TARGET: armv7-unknown-linux-musleabihf
CROSS: true
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 Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.TOOLCHAIN }}
target: ${{ matrix.TARGET }}
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.CROSS }}
command: build
args: --release --target ${{ matrix.TARGET }} --bins --examples
- name: Prepare release assets
shell: bash
run: |
mkdir -p release/examples
mkdir -p release/bin
cp {LICENSE*,COPYRIGHT,README.md,CHANGELOG.md} release/
cp -r doc release/doc
cp target/${{ matrix.TARGET }}/release/{dtnd,dtntrigger,dtnsend,dtnrecv,dtnquery} release/bin
cp target/${{ matrix.TARGET }}/release/examples/{dtnping,dtnecho2} release/examples
mv release/ dtn7-${{ env.RELEASE_VERSION }}/
- name: Create release artifacts
shell: bash
run: |
tar -czvf dtn7-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz \
dtn7-${{ env.RELEASE_VERSION }}/
shasum -a 512 dtn7-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz \
> dtn7-${{ 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: dtn7-${{ 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-20.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 core/dtn7/Cargo.toml
--token ${{ secrets.CARGO_TOKEN }}