File: deploy.yml

package info (click to toggle)
rust-cbindgen 0.29.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,248 kB
  • sloc: ansic: 15; makefile: 11
file content (67 lines) | stat: -rw-r--r-- 2,185 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: deploy

on:
  push:
    tags:
      - 'v*.*.*'

jobs:

  linux-binaries:
    permissions:
      # Grant the GITHUB_TOKEN additional permissions necessary for creating a release.
      # We only run this action for tags, so any code has already been reviewed by
      # someone with permissions to create a tag.
      contents: write

    runs-on: ubuntu-22.04

    steps:
    - uses: actions/checkout@v3

    - name: Install stable
      uses: dtolnay/rust-toolchain@stable
      with:
        targets: aarch64-unknown-linux-gnu

    - name: Install cross libc
      run: |
        sudo apt-get update
        sudo apt-get install -y libc6-arm64-cross gcc-11-aarch64-linux-gnu

    - name: semver
      run: |
        cargo +stable install cargo-semver-checks --locked
        cargo +stable semver-checks check-release

    - name: Build cbindgen
      run: |
        cargo +stable build --release
        CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc-11 cargo +stable build --target aarch64-unknown-linux-gnu --release

    - name: Strip cbindgen
      run: |
        strip target/release/cbindgen
        aarch64-linux-gnu-strip target/aarch64-unknown-linux-gnu/release/cbindgen

    - name: Handle release data and files
      id: tagName
      run: |
        VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
        echo "version=$VERSION" >> "$GITHUB_OUTPUT"
        # Steps to extract the last release notes from CHANGES:
        #   1. Remove the first three lines
        #   2. Stop at the next heading level
        #   3. Remove the last line
        #   4. Deindent the bullet points to avoid a markdown code block
        tail -n +3 CHANGES | sed '/^##/q' |
        sed '$ d' | awk '{$1=$1};1' > CHANGES.txt

    - name: Create a release
      run: |
        TAG=${{ steps.tagName.outputs.version }}
        cp target/release/cbindgen cbindgen-ubuntu22.04
        cp target/aarch64-unknown-linux-gnu/release/cbindgen cbindgen-ubuntu22.04-aarch64
        gh release create ${TAG} --title "${TAG}" --notes-file "CHANGES.txt" --draft cbindgen-ubuntu22.04 cbindgen-ubuntu22.04-aarch64
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}