i hate powershell #13
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: zijiren233/rust-build-action@v1 | |
| with: | |
| targets: | | |
| x86_64-unknown-linux-musl | |
| aarch64-unknown-linux-musl | |
| x86_64-pc-windows-gnu | |
| aarch64-apple-darwin | |
| - name: Determine crate version | |
| id: crate_version | |
| run: | | |
| set -euo pipefail | |
| VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name=="timesplit") | .version') | |
| echo "PACKAGE_VERSION=$VERSION" >> "$GITHUB_ENV" | |
| echo "package_version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Collect build outputs | |
| run: | | |
| set -euo pipefail | |
| mkdir -p dist | |
| cp target/x86_64-unknown-linux-musl/release/timesplit "dist/timesplit-${PACKAGE_VERSION}-x86_64-unknown-linux-musl" | |
| cp target/aarch64-unknown-linux-musl/release/timesplit "dist/timesplit-${PACKAGE_VERSION}-aarch64-unknown-linux-musl" | |
| cp target/x86_64-pc-windows-gnu/release/timesplit.exe "dist/timesplit-${PACKAGE_VERSION}-x86_64-pc-windows-gnu.exe" | |
| cp target/aarch64-apple-darwin/release/timesplit "dist/timesplit-${PACKAGE_VERSION}-aarch64-apple-darwin" | |
| - name: Create draft release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.crate_version.outputs.package_version }} | |
| release_name: timesplit v${{ steps.crate_version.outputs.package_version }} | |
| draft: true | |
| body: | | |
| Automated draft release for version ${{ steps.crate_version.outputs.package_version }} | |
| - name: "Upload release asset: x86_64-unknown-linux-musl" | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-x86_64-unknown-linux-musl | |
| asset_name: timesplit-${{ steps.crate_version.outputs.package_version }}-x86_64-unknown-linux-musl | |
| asset_content_type: application/octet-stream | |
| - name: "Upload release asset: aarch64-unknown-linux-musl" | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-unknown-linux-musl | |
| asset_name: timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-unknown-linux-musl | |
| asset_content_type: application/octet-stream | |
| - name: "Upload release asset: x86_64-pc-windows-gnu" | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-x86_64-pc-windows-gnu.exe | |
| asset_name: timesplit-${{ steps.crate_version.outputs.package_version }}-x86_64-pc-windows-gnu.exe | |
| asset_content_type: application/octet-stream | |
| - name: "Upload release asset: aarch64-apple-darwin" | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-darwin | |
| asset_name: timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-darwin | |
| asset_content_type: application/octet-stream | |
| - name: Upload x86_64-unknown-linux-musl binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: timesplit-${{ steps.crate_version.outputs.package_version }}-x86_64-unknown-linux-musl | |
| path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-x86_64-unknown-linux-musl | |
| if-no-files-found: error | |
| - name: Upload aarch64-unknown-linux-musl binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-unknown-linux-musl | |
| path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-unknown-linux-musl | |
| if-no-files-found: error | |
| - name: Upload x86_64-pc-windows-gnu binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: timesplit-${{ steps.crate_version.outputs.package_version }}-x86_64-pc-windows-gnu | |
| path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-x86_64-pc-windows-gnu.exe | |
| if-no-files-found: error | |
| - name: Upload aarch64-apple-darwin binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-darwin | |
| path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-darwin | |
| if-no-files-found: error |