Skip to content

ULID Tool Build and Release #14

ULID Tool Build and Release

ULID Tool Build and Release #14

name: ULID Tool Build and Release
on:
workflow_dispatch: # Manually trigger the workflow
pull_request_target:
branches:
- main
types:
- closed
jobs:
release:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' }} # Allow manual triggering
env:
IS_PROD: ${{ contains(github.event.pull_request.head.ref, 'prod') }}
VERSION_NUMBER: ${{ github.run_number }}
FILE_SUFFIX: ${{ steps.set_file_suffix.outputs.file_suffix }}

Check failure on line 18 in .github/workflows/ulid_build_release.yaml

View workflow run for this annotation

GitHub Actions / ULID Tool Build and Release

Invalid workflow file

The workflow is not valid. .github/workflows/ulid_build_release.yaml (Line: 18, Col: 20): Unrecognized named-value: 'steps'. Located at position 1 within expression: steps.set_file_suffix.outputs.file_suffix
steps:
- name: Checkout code
uses: actions/checkout@v2 # Add back the checkout step
with:
ref: 'refs/heads/main' # Ensures the main branch is checked out after merge
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build and Test ULID Tool
run: |
cd tools/ulid
cargo build --release --verbose
cargo test --verbose
- name: Debug Info
run: |
echo "FILE_SUFFIX: ${{ env.FILE_SUFFIX }}"
echo "IS_PROD: ${{ env.IS_PROD }}"
echo "Branch: ${{ github.event.pull_request.head.ref }}"
- name: Set File Suffix
id: set_file_suffix
run: echo "::set-output name=file_suffix::${{ env.IS_PROD && '' || '-beta' }}"
- name: Rename Binary
if: ${{ steps.set_file_suffix.outputs.file_suffix != '' }}
run: |
mv tools/ulid/target/release/ulid tools/ulid/target/release/ulid${{ env.FILE_SUFFIX }}
- name: Archive Binary
run: |
cd tools/ulid/target/release
zip ulid-v${{ env.VERSION_NUMBER }}${{ env.FILE_SUFFIX }}.zip ulid${{ env.FILE_SUFFIX }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ulid-v${{ env.VERSION_NUMBER }}${{ steps.set_file_suffix.outputs.file_suffix }} # Adjust tag_name based on FILE_SUFFIX
release_name: ULID Release v${{ env.VERSION_NUMBER }}${{ steps.set_file_suffix.outputs.file_suffix }} # Adjust release_name based on FILE_SUFFIX
draft: false
prerelease: ${{ !env.IS_PROD }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tools/ulid/target/release/ulid-v${{ env.VERSION_NUMBER }}${{ steps.set_file_suffix.outputs.file_suffix }}.zip # Adjust asset_path based on FILE_SUFFIX
asset_name: ulid-v${{ env.VERSION_NUMBER }}${{ steps.set_file_suffix.outputs.file_suffix }}.zip
asset_content_type: application/zip