✨ Docker and update #18
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] | |
| name: Build | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| artifact: windows | |
| filename: server-script.exe | |
| - os: macos-latest | |
| artifact: darwin | |
| filename: server-script | |
| - os: ubuntu-latest | |
| artifact: linux | |
| filename: server-script | |
| name: build | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo- | |
| - name: Update Rust | |
| run: rustup update # msrv 1.65.0 | |
| - name: build | |
| run: cargo build --release | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: target/release/${{ matrix.filename }} | |
| upload: | |
| needs: [build] | |
| name: Upload Artifacts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| # Download artifacts | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: windows | |
| path: output/windows/server-script | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: linux | |
| path: output/linux/server-script | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: darwin | |
| path: output/darwin/server-script | |
| # Parse version to output | |
| - name: Get version | |
| run: echo "::set-output name=version::$(grep -Po '(?<=version = \").+(?=\")' Cargo.toml)" | |
| id: version | |
| # Create Release | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.version }} | |
| release_name: Release ${{ steps.version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| continue-on-error: true | |
| # Upload Windows Asset | |
| - name: Upload Release Asset (Windows) | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: output/windows/server-script/server-script.exe | |
| asset_name: server-script-windows.exe | |
| asset_content_type: application/vnd.microsoft.portable-executable | |
| continue-on-error: true | |
| # Upload Linux Assets | |
| - name: Upload Release Asset (Linux) | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: output/linux/server-script/server-script | |
| asset_name: server-script-linux | |
| asset_content_type: application/x-binary | |
| continue-on-error: true | |
| # Upload Darwin assets | |
| - name: Upload Release Asset (Darwin) | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: output/darwin/server-script/server-script | |
| asset_name: server-script-darwin | |
| asset_content_type: application/x-binary | |
| continue-on-error: true |