|
| 1 | +name: Release |
| 2 | + |
| 3 | +# Push events to matching v*, i.e. v1.0, v20.15.10 |
| 4 | +on: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build Release Artifacts |
| 12 | + runs-on: ubuntu-20.04 |
| 13 | + permissions: |
| 14 | + contents: write |
| 15 | + steps: |
| 16 | + - name: Print version |
| 17 | + run: | |
| 18 | + RELEASE_TAG=${{ github.ref }} |
| 19 | + RELEASE_TAG="${RELEASE_TAG#refs/tags/}" |
| 20 | + RELEASE_VERSION="${RELEASE_TAG#v}" |
| 21 | + echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV |
| 22 | + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV |
| 23 | + echo "Release tag: $RELEASE_TAG" |
| 24 | + echo "Release version: $RELEASE_VERSION" |
| 25 | +
|
| 26 | + - name: Checkout sources |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Install system dependencies |
| 30 | + run: | |
| 31 | + sudo apt-get update |
| 32 | + sudo apt-get install --no-install-recommends --assume-yes patchelf gzip cmake make gcc g++ build-essential |
| 33 | + sudo apt-get install --no-install-recommends --assume-yes libssl-dev libglib2.0-dev pkg-config libtool flex bison autoconf automake |
| 34 | +
|
| 35 | + - name: Install toolchain |
| 36 | + uses: dtolnay/rust-toolchain@stable |
| 37 | + with: |
| 38 | + toolchain: stable |
| 39 | + |
| 40 | + - name: Fetch dependencies |
| 41 | + run: cargo fetch |
| 42 | + |
| 43 | + - name: Build release binaries |
| 44 | + run: cargo build --release |
| 45 | + |
| 46 | + - name: Setup upterm session |
| 47 | + uses: lhotari/action-upterm@v1 |
| 48 | + if: ${{ failure() }} |
| 49 | + with: |
| 50 | + ## If no one connects after 5 minutes, shut down server. |
| 51 | + wait-timeout-minutes: 5 |
| 52 | + |
| 53 | + - name: Create github release |
| 54 | + id: create_release |
| 55 | + uses: softprops/action-gh-release@v2 |
| 56 | + with: |
| 57 | + draft: false |
| 58 | + prerelease: false |
| 59 | + name: Release ${{ env.RELEASE_VERSION }} |
| 60 | + files: | |
| 61 | + target/release/ctf-util |
0 commit comments