|
| 1 | +name: Release |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - '*' |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: bash |
| 14 | + |
| 15 | +jobs: |
| 16 | + release: |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + target: |
| 20 | + - aarch64-apple-darwin |
| 21 | + - aarch64-pc-windows-msvc |
| 22 | + - aarch64-unknown-linux-musl |
| 23 | + - arm-unknown-linux-musleabihf |
| 24 | + - armv7-unknown-linux-musleabihf |
| 25 | + - x86_64-apple-darwin |
| 26 | + - x86_64-pc-windows-msvc |
| 27 | + - x86_64-unknown-linux-musl |
| 28 | + include: |
| 29 | + - target: aarch64-apple-darwin |
| 30 | + os: macos-latest |
| 31 | + target_rustflags: '' |
| 32 | + - target: aarch64-pc-windows-msvc |
| 33 | + os: windows-latest |
| 34 | + target_rustflags: '' |
| 35 | + - target: aarch64-unknown-linux-musl |
| 36 | + os: ubuntu-latest |
| 37 | + target_rustflags: '--codegen linker=aarch64-linux-gnu-gcc' |
| 38 | + - target: arm-unknown-linux-musleabihf |
| 39 | + os: ubuntu-latest |
| 40 | + target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc' |
| 41 | + - target: armv7-unknown-linux-musleabihf |
| 42 | + os: ubuntu-latest |
| 43 | + target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc' |
| 44 | + - target: x86_64-apple-darwin |
| 45 | + os: macos-latest |
| 46 | + target_rustflags: '' |
| 47 | + - target: x86_64-pc-windows-msvc |
| 48 | + os: windows-latest |
| 49 | + - target: x86_64-unknown-linux-musl |
| 50 | + os: ubuntu-latest |
| 51 | + target_rustflags: '' |
| 52 | + |
| 53 | + runs-on: ${{matrix.os}} |
| 54 | + |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Install AArch64 Toolchain |
| 59 | + if: ${{ matrix.target == 'aarch64-unknown-linux-musl' }} |
| 60 | + run: | |
| 61 | + sudo apt-get update |
| 62 | + sudo apt-get install gcc-aarch64-linux-gnu libc6-dev-i386 |
| 63 | +
|
| 64 | + - name: Install ARM Toolchain |
| 65 | + if: ${{ matrix.target == 'arm-unknown-linux-musleabihf' || matrix.target == 'armv7-unknown-linux-musleabihf' }} |
| 66 | + run: | |
| 67 | + sudo apt-get update |
| 68 | + sudo apt-get install gcc-arm-linux-gnueabihf |
| 69 | +
|
| 70 | + - name: Install AArch64 Toolchain (Windows) |
| 71 | + if: ${{ matrix.target == 'aarch64-pc-windows-msvc' }} |
| 72 | + run: | |
| 73 | + rustup target add aarch64-pc-windows-msvc |
| 74 | +
|
| 75 | + - name: Release Type |
| 76 | + id: release-type |
| 77 | + run: | |
| 78 | + if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+$ ]]; then |
| 79 | + echo ::set-output name=value::release |
| 80 | + else |
| 81 | + echo ::set-output name=value::prerelease |
| 82 | + fi |
| 83 | +
|
| 84 | + - name: Package |
| 85 | + id: package |
| 86 | + env: |
| 87 | + TARGET: ${{ matrix.target }} |
| 88 | + REF: ${{ github.ref }} |
| 89 | + OS: ${{ matrix.os }} |
| 90 | + TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }} |
| 91 | + run: ./bin/package |
| 92 | + shell: bash |
| 93 | + |
| 94 | + - name: Publish Archive |
| 95 | + |
| 96 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 97 | + with: |
| 98 | + draft: false |
| 99 | + files: | |
| 100 | + ${{ steps.package.outputs.archive }} |
| 101 | + ${{ steps.package.outputs.archive }}.sha256sum |
| 102 | + prerelease: ${{ steps.release-type.outputs.value == 'prerelease' }} |
| 103 | + env: |
| 104 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 105 | + |
| 106 | + - name: Publish Changelog |
| 107 | + |
| 108 | + if: >- |
| 109 | + ${{ |
| 110 | + startsWith(github.ref, 'refs/tags/') |
| 111 | + && matrix.target == 'x86_64-unknown-linux-musl' |
| 112 | + }} |
| 113 | + with: |
| 114 | + draft: false |
| 115 | + files: CHANGELOG.md |
| 116 | + prerelease: ${{ steps.ref-type.outputs.value != 'release' }} |
| 117 | + env: |
| 118 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments