diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c038af8..15011ac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,35 +3,51 @@ name: Rust Build on: [push] jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - targets: ['x86_64-unknown-linux-musl', 'x86_64-unknown-linux-gnu'] - - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - - - name: Install musl-tools - run: sudo apt-get update && sudo apt-get install -y musl-tools - - - name: Build - run: | - rustup target add ${{ matrix.targets }} - cargo build --release --target=${{ matrix.targets }} - - - name: Archive production artifacts - uses: actions/upload-artifact@v2 - with: - name: otk-${{ matrix.targets }} - path: ./target/${{ matrix.targets }}/release/otk + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + targets: ['x86_64-unknown-linux-musl', 'x86_64-unknown-linux-gnu'] + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + + - name: Install musl-tools + run: sudo apt-get update && sudo apt-get install -y musl-tools + + - name: Build + run: | + rustup target add ${{ matrix.targets }} + cargo build --release --target=${{ matrix.targets }} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.sha }} + release_name: $(date +%Y-%m-%d)-${{ github.sha }} + draft: false + prerelease: false + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./target/${{ matrix.targets }}/release/otk + asset_name: otk-${{ matrix.targets }} + asset_content_type: application/octet-stream