ci: Use GITHUB_OUTPUT envvar instead of set-output command #4
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: Release & Publish Workflow | |
on: | |
push: | |
branches: | |
- main | |
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 }} |