small fixes #14
This file contains hidden or 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: Build and Release | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| PROJECT_NAME: waspinput | |
| NAME_WIN32: waspinput32.dll | |
| NAME_WIN64: waspinput64.dll | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| target: [i686-pc-windows-msvc, x86_64-pc-windows-msvc] | |
| steps: | |
| - name: Checkout source | |
| uses: actions/[email protected] | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| target: ${{ matrix.target }} | |
| override: true | |
| - name: Build for ${{ matrix.target }} | |
| run: cargo build --release --target=${{ matrix.target }} | |
| - name: Rename output DLL | |
| run: | | |
| $target = "${{ matrix.target }}" | |
| $original = "target\$target\release\$env:PROJECT_NAME.dll" | |
| if ($target -eq "i686-pc-windows-msvc") { | |
| $renamed = "target\$target\release\$env:NAME_WIN32" | |
| } else { | |
| $renamed = "target\$target\release\$env:NAME_WIN64" | |
| } | |
| if (Test-Path $original) { | |
| Move-Item $original $renamed -Force | |
| Write-Host "Renamed $original to $renamed" | |
| } else { | |
| Write-Host "DLL not found: $original" | |
| exit 1 | |
| } | |
| shell: pwsh | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.target }}-dll | |
| path: | | |
| target/${{ matrix.target }}/release/${{ matrix.target == 'i686-pc-windows-msvc' && env.NAME_WIN32 || env.NAME_WIN64 }} | |
| version: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Git | |
| run: | | |
| git config --global user.name "Wasp Bot" | |
| git config --global user.email "[email protected]" | |
| - name: Get current date and commit hash | |
| run: | | |
| echo "CURRENT_YEAR=$(date +'%Y')" >> $GITHUB_ENV | |
| echo "CURRENT_MONTH=$(date +'%m')" >> $GITHUB_ENV | |
| echo "CURRENT_DAY=$(date +'%d')" >> $GITHUB_ENV | |
| echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - name: Create and push tag | |
| run: | | |
| TAG_NAME="$CURRENT_YEAR.$CURRENT_MONTH.$CURRENT_DAY-$COMMIT_HASH" | |
| echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | |
| git tag $TAG_NAME | |
| git push origin $TAG_NAME | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create GitHub release | |
| run: | | |
| gh release create $TAG_NAME \ | |
| artifacts/i686-pc-windows-msvc-dll/${{ env.NAME_WIN32 }} \ | |
| artifacts/x86_64-pc-windows-msvc-dll/${{ env.NAME_WIN64 }} \ | |
| --title "$TAG_NAME" \ | |
| --notes "Automated plugin release" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |