|
| 1 | +name: Build and Publish Compute Releases |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + |
| 10 | +jobs: |
| 11 | + |
| 12 | + check_release: |
| 13 | + if: "contains(github.event.release.tag_name, '-dev')" # continue if the tag ends with -dev |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Echo tag |
| 17 | + run: | |
| 18 | + echo "tag name: ${{ github.event.release.tag_name }}" |
| 19 | + echo "release name: ${{ github.event.release.name }}" |
| 20 | +
|
| 21 | + build: |
| 22 | + needs: check_release |
| 23 | + runs-on: ${{ matrix.runner }} |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - { runner: macos-latest, osname: macOS, arch: amd64, target: x86_64-apple-darwin, command: build } |
| 28 | + - { runner: macos-latest, osname: macOS, arch: arm64, target: aarch64-apple-darwin, command: build } |
| 29 | + - { runner: ubuntu-latest, osname: linux, arch: amd64, target: x86_64-unknown-linux-gnu, command: build } |
| 30 | + - { runner: ubuntu-latest, osname: linux, arch: arm64, target: aarch64-unknown-linux-gnu, command: build, build_args: --no-default-features } |
| 31 | + - { runner: windows-latest, osname: windows, arch: amd64, target: x86_64-pc-windows-msvc, command: build, extension: ".exe" } |
| 32 | + # - { runner: windows-latest, osname: windows, arch: arm64, target: aarch64-pc-windows-msvc, command: build, extension: ".exe", toolchain: nightly } |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout code |
| 36 | + uses: actions/checkout@v3 |
| 37 | + |
| 38 | + - name: Get the release version from the tag |
| 39 | + shell: bash |
| 40 | + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
| 41 | + |
| 42 | + - name: Build binary |
| 43 | + uses: houseabsolute/actions-rust-cross@v0 |
| 44 | + with: |
| 45 | + command: ${{ matrix.command }} |
| 46 | + target: ${{ matrix.target }} |
| 47 | + args: "--locked --release ${{ matrix.build_args }}" |
| 48 | + strip: true |
| 49 | + |
| 50 | + - name: Prepare Release File |
| 51 | + run: | |
| 52 | + # move the binary |
| 53 | + mv target/${{ matrix.target }}/release/dkn-compute${{ matrix.extension }} ./dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }}${{ matrix.extension }} |
| 54 | + |
| 55 | +
|
| 56 | + - name: Upload Launch Artifacts |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + name: dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }} |
| 60 | + path: dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }}${{ matrix.extension }} |
| 61 | + |
| 62 | + |
| 63 | + release: |
| 64 | + needs: build |
| 65 | + runs-on: ubuntu-latest |
| 66 | + |
| 67 | + steps: |
| 68 | + - name: Checkout code |
| 69 | + uses: actions/checkout@v3 |
| 70 | + with: |
| 71 | + fetch-depth: 0 # Fetch all tags and history |
| 72 | + |
| 73 | + - name: Download Launch Artifacts |
| 74 | + uses: actions/download-artifact@v4 |
| 75 | + with: |
| 76 | + merge-multiple: true |
| 77 | + path: ./artifacts |
| 78 | + |
| 79 | + - name: Create release with artifacts |
| 80 | + uses: ncipollo/release-action@v1 |
| 81 | + with: |
| 82 | + name: ${{ github.event.release.name }} |
| 83 | + tag: ${{ github.event.release.tag_name }} |
| 84 | + artifacts: "artifacts/*" |
| 85 | + artifactContentType: application/octet-stream |
| 86 | + allowUpdates: true |
| 87 | + # draft: true |
0 commit comments