Skip to content

Commit 70c1f96

Browse files
authored
Build a zip with the .h and libraries + upload to release on release (#168)
* Build a zip with the .h and libraries + upload to release on release * Windows zip is naturally different * rename dist to the actual zip name, so when unzipped it also has that name * Pass dist dir to subsequent steps * Fix missed dist dir
1 parent 2e9bc3e commit 70c1f96

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/build-c-libraries.yml

+49
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ jobs:
6969
with:
7070
fetch-depth: 0
7171

72+
- name: Set Env
73+
uses: Chia-Network/actions/setjobenv@main
74+
env:
75+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
7277
- name: Checkout mpir for windows
7378
if: matrix.os.matrix == 'windows'
7479
uses: actions/checkout@v4
@@ -90,3 +95,47 @@ jobs:
9095
with:
9196
name: c-libraries-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}
9297
path: ./src/lib
98+
99+
- name: Assemble directory of headers and libraries for distribution
100+
shell: bash
101+
run: |
102+
DIST_DIR="chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}"
103+
echo "DIST_DIR=$DIST_DIR" >> "$GITHUB_ENV"
104+
mkdir -p ${DIST_DIR}/static ${DIST_DIR}/shared
105+
106+
cp src/c_bindings/c_wrapper.h ${DIST_DIR}/
107+
find src/lib/static -type f -exec cp {} ${DIST_DIR}/static/ \;
108+
find src/lib/shared -type f -exec cp {} ${DIST_DIR}/shared/ \;
109+
110+
- name: Zip (linux/mac)
111+
if: runner.os != 'Windows'
112+
run: |
113+
zip -r chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip ${{ env.DIST_DIR }}
114+
115+
- name: Zip (windows)
116+
if: runner.os == 'Windows'
117+
run: |
118+
Compress-Archive -Path ${{ env.DIST_DIR }}/* -Destination chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip
119+
120+
- name: Upload zip as artifact
121+
uses: actions/upload-artifact@v3
122+
with:
123+
name: chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}
124+
path: |
125+
${{ github.workspace }}/chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip
126+
127+
- name: Upload release artifacts
128+
if: env.RELEASE == 'true'
129+
env:
130+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+
run: |
132+
gh release upload \
133+
$RELEASE_TAG \
134+
chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip
135+
136+
- uses: Chia-Network/actions/github/jwt@main
137+
138+
- name: Notify new build
139+
if: env.RELEASE == 'true'
140+
run: |
141+
curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"release_version":"${{ env.RELEASE_TAG }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/chiavdfc/trigger

0 commit comments

Comments
 (0)