on:
push:
tags:
- 'v*.*.*'
name: release
jobs:
build_and_release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Compile Tinytools
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
- name: Fetch all tags
run: git fetch origin +refs/tags/*:refs/tags/*
- name: Get name of current tag
id: get_tag_name
run: echo "::set-output name=tag_name::${GITHUB_REF/refs\/tags\//}"
- name: Generate changelog
id: changelog
run: |
prev_tag=$(git describe --abbrev=0 --tags ${{ github.ref }}^)
log=$(git log --oneline --decorate=no $prev_tag..${{ github.ref }})
log="${log//'%'/'%25'}"
log="${log//'~'/\\~}"
log="${log//$'\n'/'%0A'}"
log="${log//$'\r'/'%0D'}"
echo "::set-output name=value::$log"
- name: Create release with compiled binary
id: upload-release-asset
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: false
tag_name: ${{ github.ref }}
name: Release ${{ steps.get_tag_name.outputs.tag_name }}
body: ${{ steps.changelog.outputs.value }}
files: target/release/tt