Skip to content

Release & Publish Workflow #7

Release & Publish Workflow

Release & Publish Workflow #7

name: Release & Publish Workflow
on:
workflow_dispatch:
jobs:
check-tag:
runs-on: ubuntu-latest
outputs:
tag_exists: ${{ steps.tag_check.outputs.tag_exists }}
steps:
- uses: actions/checkout@v2
- name: Check for Tag
id: tag_check
run: |
TAG=$(git tag --points-at HEAD)
if [ -z "$TAG" ]; then
echo "tag_exists=false" >> $GITHUB_ENV
echo "tag_exists=false" >> $GITHUB_OUTPUT
else
echo "tag_exists=true" >> $GITHUB_ENV
echo "tag_exists=true" >> $GITHUB_OUTPUT
fi
shell: bash
build-and-release:
# needs: check-tag
# if: needs.check-tag.outputs.tag_exists == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Test Build
run: cargo build --release
- name: Publish to Cargo
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Build Linux Executable
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: target/x86_64-unknown-linux-gnu/release/turbocommit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}