Skip to content

Commit 5c34fda

Browse files
committed
cpack upload artifacts
1 parent 33ac85f commit 5c34fda

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: ci
22
env:
3-
CMAKE_GENERATOR: Ninja
3+
HOMEBREW_NO_INSTALL_CLEANUP: 1
4+
CMAKE_GENERATOR: Ninja
45

56
on:
67
push:
@@ -9,6 +10,9 @@ on:
910
- "**.cmake"
1011
- "**.f90"
1112
- ".github/workflows/ci.yml"
13+
release:
14+
types: [published]
15+
1216

1317
jobs:
1418

@@ -33,6 +37,31 @@ jobs:
3337
- run: ctest --parallel 2 --output-on-failure
3438
working-directory: Examples/build
3539

40+
- name: create package
41+
run: cpack --config build/CPackConfig.cmake
42+
43+
- name: Upload artifact
44+
uses: actions/upload-artifact@v1
45+
with:
46+
name: binary-archive
47+
path: build/package
48+
49+
- name: get version
50+
id: get_version
51+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
52+
53+
- name: Upload release asset
54+
if: github.event.action == 'published'
55+
uses: actions/upload-release-asset@v1
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
upload_url: ${{ github.event.release.upload_url }}
60+
asset_path: build/package/h5fortran-${{ steps.get_version.outputs.VERSION }}-Linux.zip
61+
asset_name: h5fortran-${{ steps.get_version.outputs.VERSION }}-Linux.zip
62+
asset_content_type: application/zip
63+
64+
3665

3766
mac:
3867
needs: linux
@@ -52,3 +81,27 @@ jobs:
5281
- run: cmake --build Examples/build --parallel
5382
- run: ctest --parallel 2 --output-on-failure
5483
working-directory: Examples/build
84+
85+
- name: create package
86+
run: cpack --config build/CPackConfig.cmake
87+
88+
- name: Upload artifact
89+
uses: actions/upload-artifact@v1
90+
with:
91+
name: binary-archive
92+
path: build/package
93+
94+
- name: get version
95+
id: get_version
96+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
97+
98+
- name: Upload release asset
99+
if: github.event.action == 'published'
100+
uses: actions/upload-release-asset@v1
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
with:
104+
upload_url: ${{ github.event.release.upload_url }}
105+
asset_path: build/package/h5fortran-${{ steps.get_version.outputs.VERSION }}-Darwin.zip
106+
asset_name: h5fortran-${{ steps.get_version.outputs.VERSION }}-Darwin.zip
107+
asset_content_type: application/zip

.github/workflows/ci_windows.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- "**/CMakeLists.txt"
99
- "**.cmake"
1010
- ".github/workflows/ci_windows.yml"
11+
release:
12+
types: [published]
13+
1114

1215
jobs:
1316

@@ -52,3 +55,27 @@ jobs:
5255
- run: cmake --build Examples/build --parallel
5356
- run: ctest --parallel 2 --output-on-failure
5457
working-directory: Examples/build
58+
59+
- name: create package
60+
run: cpack --config build/CPackConfig.cmake
61+
62+
- name: Upload artifact
63+
uses: actions/upload-artifact@v1
64+
with:
65+
name: binary-archive
66+
path: build/package
67+
68+
- name: get version
69+
id: get_version
70+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
71+
72+
- name: Upload release asset
73+
if: github.event.action == 'published'
74+
uses: actions/upload-release-asset@v1
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
with:
78+
upload_url: ${{ github.event.release.upload_url }}
79+
asset_path: build/package/h5fortran-${{ steps.get_version.outputs.VERSION }}-win64.zip
80+
asset_name: h5fortran-${{ steps.get_version.outputs.VERSION }}-win64.zip
81+
asset_content_type: application/zip

cmake/install.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ set(CPACK_PACKAGE_CONTACT "Michael Hirsch")
4040
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libhdf5-dev (>=1.10)")
4141
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
4242
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
43+
set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/package")
4344

4445
install(FILES ${CPACK_RESOURCE_FILE_README} ${CPACK_RESOURCE_FILE_LICENSE}
4546
DESTINATION share/docs/${PROJECT_NAME})

0 commit comments

Comments
 (0)