From 48b73909b1710a08aa5e160c0abb0402ca52965e Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Thu, 28 Oct 2021 21:11:43 +0300 Subject: [PATCH] Add release pipeline --- .github/workflows/release.yml | 73 +++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..510bafec --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,73 @@ +name: CD Native + +on: + release: + types: [ created ] + +jobs: + build: + strategy: + fail-fast: false + matrix: + platform: [ ubuntu-latest, macos-latest, windows-latest ] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + components: rustfmt, clippy + - uses: actions-rs/cargo@v1.0.1 + name: Check format + with: + command: fmt + args: --all -- --check + - uses: actions-rs/cargo@v1.0.1 + name: Run clippy + with: + command: clippy + args: --all-targets --locked -- -D warnings + - uses: actions-rs/cargo@v1.0.1 + name: Run clippy (All features) + with: + command: clippy + args: --all-targets --locked --all-features -- -D warnings + - uses: actions-rs/cargo@v1.0.1 + name: Run tests + with: + command: test + - uses: actions-rs/cargo@v1.0.1 + name: Build + with: + command: build + args: --release --all-features + - name: Rename Release (Unix) + run: | + cargo install default-target + mkdir assets + FILENAME=topgrade-${{github.event.release.tag_name}}-$(default-target) + mv target/release/topgrade assets + cd assets + tar --format=ustar -czf $FILENAME.tar.gz topgrade + rm topgrade + ls . + if: ${{ matrix.platform != 'windows-latest' }} + shell: bash + - name: Rename Release (Windows) + run: | + cargo install default-target + mkdir assets + FILENAME=topgrade-${{github.event.release.tag_name}}-$(default-target) + mv target/release/topgrade.exe assets/topgrade.exe + cd assets + powershell Compress-Archive -Path * -Destination ${FILENAME}.zip + rm topgrade.exe + ls . + if: ${{ matrix.platform == 'windows-latest' }} + shell: bash + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: assets/*