This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Update README.md #43
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
| on: | |
| push: | |
| branches: | |
| - main | |
| name: Release | |
| jobs: | |
| create-release: | |
| name: Create GitHub release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create artifacts directory | |
| run: mkdir artifacts | |
| - name: Create Release | |
| id: release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: draft | |
| release_name: draft | |
| draft: true | |
| - name: Save release upload URL to artifact | |
| run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v1 | |
| with: | |
| name: artifacts | |
| path: artifacts | |
| build: | |
| name: Build | |
| runs-on: '${{ matrix.os }}' | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| suffix: '' | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| suffix: '' | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| suffix: '' | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| suffix: .exe | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: ${{ matrix.target }} | |
| override: true | |
| - name: Get release download URL | |
| uses: actions/download-artifact@v1 | |
| with: | |
| name: artifacts | |
| path: artifacts | |
| - name: Set release upload URL and release version | |
| shell: bash | |
| run: | | |
| release_upload_url="$(cat artifacts/release-upload-url)" | |
| echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV | |
| echo "release upload url: $RELEASE_UPLOAD_URL" | |
| - uses: actions-rs/cargo@v1 | |
| id: cargo-build-release | |
| with: | |
| command: build | |
| args: --release --target=${{ matrix.target }} | |
| - name: Upload release asset | |
| id: upload-release-asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ env.RELEASE_UPLOAD_URL }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
| asset_path: ./target/${{ matrix.target }}/release/tool-new-release${{ matrix.suffix }} | |
| asset_name: tool-new-release-${{ matrix.target }}${{ matrix.suffix }} | |
| asset_content_type: application/octet-stream | |
| build_musl: | |
| name: Build with musl target | |
| runs-on: '${{ matrix.os }}' | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| suffix: '' | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: ${{ matrix.target }} | |
| override: true | |
| - name: Add musl target | |
| run: | | |
| rustup target add x86_64-unknown-linux-musl | |
| - name: Install musl | |
| run: | | |
| sudo apt-get install musl-tools | |
| - name: Get release download URL | |
| uses: actions/download-artifact@v1 | |
| with: | |
| name: artifacts | |
| path: artifacts | |
| - name: Set release upload URL and release version | |
| shell: bash | |
| run: | | |
| release_upload_url="$(cat artifacts/release-upload-url)" | |
| echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV | |
| echo "release upload url: $RELEASE_UPLOAD_URL" | |
| - uses: actions-rs/cargo@v1 | |
| with: | |
| command: build | |
| args: --release --target=${{ matrix.target }} | |
| - name: Upload release asset | |
| id: upload-release-asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ env.RELEASE_UPLOAD_URL }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
| asset_path: ./target/${{ matrix.target }}/release/tool-new-release${{ matrix.suffix }} | |
| asset_name: tool-new-release-${{ matrix.target }}${{ matrix.suffix }} | |
| asset_content_type: application/octet-stream |