Skip to content

Commit 30b4d18

Browse files
committed
add build-dev-exe workflow
1 parent 346794c commit 30b4d18

File tree

2 files changed

+99
-18
lines changed

2 files changed

+99
-18
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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

.github/workflows/build_prod_exe.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@ permissions:
99

1010
jobs:
1111

12+
check_release:
13+
if: "! contains(github.event.release.tag_name, '-dev')" # skip 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+
1221
build:
22+
needs: check_release
1323
runs-on: ${{ matrix.runner }}
1424
strategy:
1525
matrix:
@@ -66,27 +76,11 @@ jobs:
6676
merge-multiple: true
6777
path: ./artifacts
6878

69-
- name: Get the latest tag
70-
id: get_latest_tag
71-
run: |
72-
# latest release tag
73-
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "untagged")
74-
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
75-
76-
# latest release name
77-
LATEST_RELEASE=$(curl -s \
78-
-H "Accept: application/vnd.github.v3+json" \
79-
https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.name // "no-release-found"')
80-
echo "LATEST_RELEASE=$LATEST_RELEASE" >> $GITHUB_ENV
81-
82-
echo "Latest Tag: $LATEST_TAG"
83-
echo "Latest Release: $LATEST_RELEASE"
84-
8579
- name: Create release with artifacts
8680
uses: ncipollo/release-action@v1
8781
with:
88-
name: ${{ env.LATEST_RELEASE }}
89-
tag: ${{ env.LATEST_TAG }}
82+
name: ${{ github.event.release.name }}
83+
tag: ${{ github.event.release.tag_name }}
9084
artifacts: "artifacts/*"
9185
artifactContentType: application/octet-stream
9286
allowUpdates: true

0 commit comments

Comments
 (0)