|
| 1 | +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 OR MIT |
| 3 | +name: Release |
| 4 | +on: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - kani-* |
| 8 | + |
| 9 | +jobs: |
| 10 | + Release: |
| 11 | + name: Release |
| 12 | + runs-on: ubuntu-20.04 |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: Get version |
| 18 | + run: | |
| 19 | + # pkgid is something like file:///home/ubuntu/kani#kani-verifier:0.1.0 |
| 20 | + echo "CRATE_VERSION=$(cargo pkgid | cut -d: -f3)" >> $GITHUB_ENV |
| 21 | + # GITHUB_REF is refs/tags/kani-0.1.0 |
| 22 | + echo "TAG_VERSION=$(echo ${{ github.ref }} | cut -d "-" -f 2)" >> $GITHUB_ENV |
| 23 | + # Output for upload scripts to see |
| 24 | + echo ::set-output name=version::$TAG_VERSION |
| 25 | + - name: Version Check |
| 26 | + run: | |
| 27 | + if [[ ${{ env.CRATE_VERSION }} != ${{ env.TAG_VERSION }} ]]; then |
| 28 | + echo "Git tag ${{env.TAG_VERSION}} did not match crate version ${{env.CRATE_VERSION}}" |
| 29 | + exit 1 |
| 30 | + fi |
| 31 | +
|
| 32 | + - name: Create release |
| 33 | + uses: actions/create-release@v1 |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + with: |
| 37 | + tag_name: kani-${{ env.TAG_VERSION }} |
| 38 | + release_name: kani-${{ env.TAG_VERSION }} |
| 39 | + body: | |
| 40 | + Kani Rust verifier release bundle version ${{ env.TAG_VERSION }}. |
| 41 | + draft: true |
| 42 | + prerelease: false |
| 43 | + |
| 44 | + Upload: |
| 45 | + name: Upload |
| 46 | + needs: Release |
| 47 | + runs-on: ${{ matrix.os }} |
| 48 | + strategy: |
| 49 | + matrix: |
| 50 | + os: [macos-10.15, ubuntu-20.04] |
| 51 | + include: |
| 52 | + - os: macos-10.15 |
| 53 | + target: x86_64-apple-darwin |
| 54 | + - os: ubuntu-20.04 |
| 55 | + target: x86_64-unknown-linux-gnu |
| 56 | + steps: |
| 57 | + - name: Checkout code |
| 58 | + uses: actions/checkout@v2 |
| 59 | + |
| 60 | + - name: Setup Kani Dependencies |
| 61 | + uses: ./.github/actions/setup |
| 62 | + with: |
| 63 | + os: ${{ matrix.os }} |
| 64 | + |
| 65 | + - name: Build release bundle |
| 66 | + run: | |
| 67 | + cargo run -p make-kani-release -- ${{ needs.Release.outputs.version }} |
| 68 | +
|
| 69 | + - name: Upload artifact |
| 70 | + uses: actions/upload-release-asset@v1 |
| 71 | + env: |
| 72 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + with: |
| 74 | + upload_url: ${{ needs.Release.outputs.upload_url }} |
| 75 | + asset_path: kani-${{ needs.Release.outputs.version }}-${{ matrix.target }}.tar.gz |
| 76 | + asset_name: kani-${{ needs.Release.outputs.version }}-${{ matrix.target }}.tar.gz |
| 77 | + asset_content_type: application/gzip |
| 78 | + |
0 commit comments