Update configuration and main modules for improved structure #24
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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| new_tag: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@main | |
| with: | |
| fetch-depth: 0 | |
| - uses: SebRollen/toml-action@main | |
| id: read_toml | |
| with: | |
| file: 'Cargo.toml' | |
| field: 'package.version' | |
| - uses: rickstaa/action-create-tag@main | |
| id: "tag_create" | |
| with: | |
| tag: "${{ steps.read_toml.outputs.value }}" | |
| tag_exists_error: false | |
| message: "Release ${{ steps.read_toml.outputs.value }}" | |
| outputs: | |
| tag_exists: ${{ steps.tag_create.outputs.tag_exists }} | |
| tag_name: "${{ steps.read_toml.outputs.value }}" | |
| build: | |
| env: | |
| RUST_BACKTRACE: full | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| output: ccs | |
| dist: ccs-linux-amd64.zip | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| output: ccs | |
| dist: ccs-linux-aarch64.zip | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| output: ccs.exe | |
| dist: ccs-windows-amd64.zip | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| output: ccs.exe | |
| dist: ccs-windows-aarch64.zip | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| output: ccs | |
| dist: ccs-macos-amd64.zip | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| output: ccs | |
| dist: ccs-macos-aarch64.zip | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@main | |
| - name: Install Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@main | |
| with: | |
| toolchain: nightly | |
| target: ${{ matrix.target }} | |
| - name: Install cross | |
| run: cargo install cross | |
| - name: Cargo build ${{ matrix.target }} | |
| if: ${{ !contains(matrix.os, 'ubuntu') }} | |
| timeout-minutes: 120 | |
| run: cargo build -r --target ${{ matrix.target }} | |
| - name: Cross build ${{ matrix.target }} | |
| if: ${{ contains(matrix.os, 'ubuntu') }} | |
| timeout-minutes: 120 | |
| run: cross build -r --target ${{ matrix.target }} | |
| - name: Move file | |
| run: mv target/${{ matrix.target }}/release/${{ matrix.output }} ./${{ matrix.output }} | |
| - name: Rename file not on windows | |
| if: ${{ !contains(matrix.os, 'windows') }} | |
| run: zip ${{ matrix.dist }} ${{ matrix.output }} | |
| - name: Rename file on windows | |
| if: ${{ contains(matrix.os, 'windows') }} | |
| run: powershell Compress-Archive -Path ${{ matrix.output }} -DestinationPath ${{ matrix.dist }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: my-artifact | |
| path: ${{ matrix.dist }} | |
| release: | |
| if: ${{ needs.new_tag.outputs.tag_exists == 'false' }} | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| - new_tag | |
| steps: | |
| - uses: actions/checkout@main | |
| with: | |
| ref: ${{ needs.new_tag.outputs.tag_name }} | |
| - name: Show tags | |
| run: git tag -l | |
| - name: Download artifacts | |
| uses: actions/download-artifact@main | |
| with: | |
| name: my-artifact | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -al artifacts | |
| - name: Create release | |
| uses: ncipollo/release-action@main | |
| with: | |
| artifacts: artifacts/* | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ needs.new_tag.outputs.tag_name }} | |
| generateReleaseNotes: true | |
| draft: false | |
| prerelease: false |