Skip to content

Commit 61a5921

Browse files
authored
Merge pull request #36 from CBIIT/CRDCDH-1833
CRDCDH-1833
2 parents 84c607a + aad546b commit 61a5921

File tree

2 files changed

+136
-0
lines changed

2 files changed

+136
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Build and Attach Binary Files
2+
on:
3+
release:
4+
types: [created]
5+
workflow_dispatch:
6+
7+
jobs:
8+
build-binary-files-windows:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Printing the branch currently working on
12+
run: echo "BRANCH_NAME=${{ matrix.branch-name }}"
13+
- name: Check out the branch
14+
uses: actions/checkout@v2
15+
with:
16+
submodules: true
17+
- name: Set up Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: '3.x'
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install -r requirements.txt
26+
pip install pyinstaller # Install pyinstaller
27+
28+
- name: Build Windows binary & add configuration files and README.md
29+
run: |
30+
pyinstaller --onefile --distpath dist/windows --name uploader.exe src/uploader.py
31+
cp -R configs dist/windows
32+
cp README.md dist/windows
33+
34+
- name: Compress Windows binary
35+
run: |
36+
cd dist/windows
37+
zip -r ../../crdc-datahub-cli-uploader-windows.zip .
38+
39+
- name: Upload Windows binary to release
40+
uses: actions/upload-release-asset@v1
41+
with:
42+
upload_url: ${{ github.event.release.upload_url }}
43+
asset_path: ./crdc-datahub-cli-uploader-windows.zip
44+
asset_name: crdc-datahub-cli-uploader-windows.zip
45+
asset_content_type: application/zip
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
49+
build-binary-macOS-files:
50+
runs-on: macos-latest # GitHub needs a base runner
51+
steps:
52+
- name: Printing the branch currently working on
53+
run: echo "BRANCH_NAME=${{ matrix.branch-name }}"
54+
- name: Check out the branch
55+
uses: actions/checkout@v2
56+
with:
57+
submodules: true
58+
59+
- name: Set up Python
60+
uses: actions/setup-python@v2
61+
with:
62+
python-version: '3.x'
63+
64+
- name: Install dependencies
65+
run: |
66+
python -m pip install --upgrade pip
67+
pip install -r requirements.txt
68+
pip install pyinstaller # Install pyinstaller
69+
70+
- name: Build source code zip
71+
run: zip -r crdc-datahub-cli-uploader-src.zip .
72+
73+
74+
- name: Build macOS Intel binary & add configuration files and README.md
75+
run: |
76+
pyinstaller --onefile --paths=src/bento --distpath dist/mac-x64 --name uploader src/uploader.py
77+
cp -R configs dist/mac-x64
78+
cp README.md dist/mac-x64
79+
80+
- name: Build macOS Apple Silicon binary & add configuration files and README.md
81+
env:
82+
ARCHFLAGS: "-arch arm64" # Ensures build for Apple Silicon
83+
run: |
84+
pyinstaller --onefile --paths=src/bento --distpath dist/mac-arm --name uploader src/uploader.py
85+
cp -R configs dist/mac-arm
86+
cp README.md dist/mac-arm
87+
88+
- name: Compress Binary macOS Intel Files
89+
run: |
90+
cd dist/mac-x64
91+
zip -r ../../crdc-datahub-cli-uploader-mac-x64.zip .
92+
shell: bash
93+
94+
- name: Compress Binary Apple Silicon Files
95+
run: |
96+
cd dist/mac-arm
97+
zip -r ../../crdc-datahub-cli-uploader-mac-arm.zip .
98+
shell: bash
99+
100+
- name: Upload macOS Intel binary to release
101+
uses: actions/upload-release-asset@v1
102+
with:
103+
upload_url: ${{ github.event.release.upload_url }}
104+
asset_path: ./crdc-datahub-cli-uploader-mac-x64.zip
105+
asset_name: crdc-datahub-cli-uploader-mac-x64.zip
106+
asset_content_type: application/zip
107+
env:
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
110+
- name: Upload macOS Apple Silicon binary to release
111+
uses: actions/upload-release-asset@v1
112+
with:
113+
upload_url: ${{ github.event.release.upload_url }}
114+
asset_path: ./crdc-datahub-cli-uploader-mac-arm.zip
115+
asset_name: crdc-datahub-cli-uploader-mac-arm.zip
116+
asset_content_type: application/zip
117+
env:
118+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
120+
- name: Upload source code to release
121+
uses: actions/upload-release-asset@v1
122+
with:
123+
upload_url: ${{ github.event.release.upload_url }}
124+
asset_path: ./crdc-datahub-cli-uploader-src.zip
125+
asset_name: crdc-datahub-cli-uploader-src.zip
126+
asset_content_type: application/zip
127+
env:
128+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,11 @@ Depends on how Python3 was installed, on some systems you need to use “python
137137

138138
`$ python3 src/uploader.py --config configs/metadata-upload.yml`
139139

140+
### Execute Upload Command for Binary File
141+
For **macOS/Linux**:
142+
143+
`$ ./uploader --config configs/metadata-upload.yml`
144+
145+
For **Windows**:
146+
147+
`> uploader.exe --config configs/metadata-upload.yml`

0 commit comments

Comments
 (0)