Skip to content

Publish and Create Release #9

Publish and Create Release

Publish and Create Release #9

Workflow file for this run

name: Publish and Create Release
on:
pull_request:
types: [closed]
workflow_dispatch:
jobs:
publish:
if: >
${{ github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.head.ref, 'bump-version-') }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Set up Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Fetch all tags
run: git fetch --tags
- name: Get the latest tag
id: get_latest_tag
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null || echo "")
if [ -z "$latest_tag" ]; then
echo "No tags found"
exit 1
fi
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Publish to Crates.io
run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.latest_tag }}
release_name: ${{ env.latest_tag }}
body: |
Changes in this Release:
- **Will be listed**
Please edit this release to add more details.
draft: false
prerelease: true