Give cargo-dist a try-out #183
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: "Publish new release" | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
- labeled | |
jobs: | |
release: | |
name: Publish new release | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged && contains( github.event.pull_request.labels.*.name, 'Release') | |
steps: | |
- name: Extract version from branch name (for release branches) | |
if: startsWith(github.event.pull_request.head.ref, 'release/') | |
run: | | |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | |
VERSION=${BRANCH_NAME#release/} | |
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Initialize mandatory git config | |
run: | | |
git config user.name "GitHub actions" | |
git config user.email [email protected] | |
- name: Pushing tags | |
run: | | |
VER=$(echo v${{ env.RELEASE_VERSION }} | sed 's/.*rc.*/rc/') | |
echo "RC=$VER" >> $GITHUB_ENV | |
git tag -a -m "Release v${{ env.RELEASE_VERSION }}" "v${{ env.RELEASE_VERSION }}" | |
git push origin v${{ env.RELEASE_VERSION }} | |
- name: Create release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v${{ env.RELEASE_VERSION }} | |
release_name: Release v${{ env.RELEASE_VERSION }} | |
draft: false | |
prerelease: ${{env.RC == 'rc'}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
- name: Trigger publish crates workflow | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: Publish crates | |
token: ${{ secrets.BOT_TOKEN }} |