Skip to content

Commit 2eba0c6

Browse files
authored
Create komodod_cd.yml
1 parent 9891e58 commit 2eba0c6

1 file changed

Lines changed: 195 additions & 0 deletions

File tree

.github/workflows/komodod_cd.yml

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
name: Komodo build releases
2+
3+
on:
4+
push:
5+
- jl777_dev
6+
schedule:
7+
# Run at 00:00 UTC on Monday
8+
- cron: "0 0 * * 1"
9+
10+
jobs:
11+
12+
linux-build:
13+
name: linux-build
14+
runs-on: ubuntu-latest
15+
env:
16+
IMAGE_REPO: docker.pkg.github.com/meshbits/komodo/komodobuild_linux:latest
17+
CONTAINER_NAME: komodobuild_linux
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Docker Login
24+
uses: azure/docker-login@v1
25+
with:
26+
login-server: docker.pkg.github.com
27+
username: $GITHUB_ACTOR
28+
password: ${{ secrets.ns408_packages_token }}
29+
30+
- name: Pull Docker image
31+
run: |
32+
docker pull ${{ env.IMAGE_REPO }}
33+
34+
- name: Run image (Build Linux)
35+
run: |
36+
nproc=$(cat /proc/cpuinfo | grep processor | wc -l)
37+
docker run -it -d --name ${{ env.CONTAINER_NAME }} -v $GITHUB_WORKSPACE:/workspace -w /workspace ${{ env.IMAGE_REPO }}
38+
docker exec -w /workspace ${{ env.CONTAINER_NAME }} ./zcutil/build.sh -j$(nproc)
39+
docker exec -w /workspace ${{ env.CONTAINER_NAME }} zip --junk-paths komodo-linux src/komodod src/komodo-cli
40+
41+
- name: Upload komodo-linux.zip as artifact
42+
uses: actions/upload-artifact@v1
43+
with:
44+
name: komodo-linux
45+
path: ./komodo-linux.zip
46+
47+
macOS-build:
48+
name: macOS-build
49+
runs-on: macos-latest
50+
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v2
54+
55+
- name: Install deps (macOS)
56+
run: |
57+
brew update
58+
brew upgrade
59+
brew tap discoteq/discoteq; brew install flock
60+
brew install autoconf autogen automake binutils \
61+
gcc@8 protobuf coreutils wget python3
62+
63+
- name: Build (macOS)
64+
run: |
65+
./zcutil/build-mac.sh -j$(sysctl -n hw.ncpu)
66+
zip --junk-paths komodo-macOS src/komodod src/komodo-cli
67+
68+
- name: Upload komodo-macOS.zip as artifact
69+
uses: actions/upload-artifact@v1
70+
with:
71+
name: komodo-macOS
72+
path: ./komodo-macOS.zip
73+
74+
windows-build:
75+
name: windows-build (mingw)
76+
runs-on: ubuntu-20.04
77+
env:
78+
IMAGE_REPO: docker.pkg.github.com/meshbits/komodo/komodobuild_win:latest
79+
CONTAINER_NAME: komodobuild_win
80+
81+
steps:
82+
- name: Checkout code
83+
uses: actions/checkout@v2
84+
85+
- name: Docker Login
86+
uses: azure/docker-login@v1
87+
with:
88+
login-server: docker.pkg.github.com
89+
username: $GITHUB_ACTOR
90+
password: ${{ secrets.ns408_packages_token }}
91+
92+
- name: Pull Docker image
93+
run: |
94+
docker pull ${{ env.IMAGE_REPO }}
95+
96+
- name: Run image (Build Windows)
97+
run: |
98+
nproc=$(cat /proc/cpuinfo | grep processor | wc -l)
99+
docker run -it -d --name ${{ env.CONTAINER_NAME }} -v $GITHUB_WORKSPACE:/workspace -w /workspace ${{ env.IMAGE_REPO }}
100+
docker exec -w /workspace ${{ env.CONTAINER_NAME }} ./zcutil/build-win.sh -j$(nproc)
101+
docker exec -w /workspace ${{ env.CONTAINER_NAME }} \
102+
zip --junk-paths komodo-win src/*.exe src/*.dll
103+
104+
- name: Upload komodo-win.zip as artifact
105+
uses: actions/upload-artifact@v1
106+
with:
107+
name: komodo-win
108+
path: ./komodo-win.zip
109+
110+
publish-release:
111+
name: Publishing CD releases
112+
runs-on: ubuntu-latest
113+
needs: [macOS-build, windows-build]
114+
115+
steps:
116+
- name: Download komodo-linux.zip
117+
uses: actions/download-artifact@v1
118+
with:
119+
name: komodo-linux
120+
121+
- name: Download komodo-macOS.zip
122+
uses: actions/download-artifact@v1
123+
with:
124+
name: komodo-macOS
125+
126+
- name: Download komodo-win.zip
127+
uses: actions/download-artifact@v1
128+
with:
129+
name: komodo-win
130+
131+
- name: Extract branch name
132+
shell: bash
133+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
134+
id: extract_branch
135+
136+
- name: Shortify commit sha
137+
shell: bash
138+
run: echo "##[set-output name=sha_short;]$(echo ${GITHUB_SHA::7})"
139+
id: shortify_commit
140+
141+
- name: Get KOMODO_VERSION
142+
shell: bash
143+
run: echo "##[set-output name=version_id;]$(grep "define KOMODO_VERSION" src/rpc/misc.cpp | awk '{print $3}')"
144+
id: komodo_version
145+
146+
- name: Create Release
147+
id: create_release
148+
uses: actions/create-release@latest
149+
env:
150+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151+
with:
152+
tag_name: release_buildv0.${{ github.run_number }}_${{ steps.komodo_version.outputs.version_id }}
153+
release_name: release_buildv0.${{ github.run_number }}_${{ steps.komodo_version.outputs.version_id }}
154+
body: |
155+
CD Release
156+
Github SHA: ${{ github.sha }}
157+
Branch: ${{ steps.extract_branch.outputs.branch }}
158+
Build number: ${{ github.run_number }}
159+
version: v0.${{ github.run_number }}
160+
Komodo version: ${{ steps.komodo_version.outputs.version_id }}
161+
draft: false
162+
prerelease: true
163+
164+
- name: Upload Linux Release Asset
165+
id: upload-linux-release-asset
166+
uses: actions/upload-release-asset@latest
167+
env:
168+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
169+
with:
170+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
171+
asset_path: komodo-linux/komodo-linux.zip
172+
asset_name: komodo_linux_v0.${{ github.run_number }}.zip
173+
asset_content_type: application/zip
174+
175+
- name: Upload macOS Release Asset
176+
id: upload-macOS-release-asset
177+
uses: actions/upload-release-asset@latest
178+
env:
179+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
180+
with:
181+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
182+
asset_path: komodo-macOS/komodo-macOS.zip
183+
asset_name: komodo_macOS_v0.${{ github.run_number }}.zip
184+
asset_content_type: application/zip
185+
186+
- name: Upload Windows Release Asset
187+
id: upload-windows-release-asset
188+
uses: actions/upload-release-asset@latest
189+
env:
190+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
191+
with:
192+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
193+
asset_path: komodo-win/komodo-win.zip
194+
asset_name: komodo_win_v0.${{ github.run_number }}.zip
195+
asset_content_type: application/zip

0 commit comments

Comments
 (0)