Skip to content

Commit f709f29

Browse files
authored
Merge pull request #2 from TypeScriptPlayground/github-CI
GitHub ci
2 parents 1057698 + b198d2f commit f709f29

File tree

3 files changed

+93
-28
lines changed

3 files changed

+93
-28
lines changed

.github/workflows/build_linux.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
paths:
77
- 'include/**'
88
- 'src/**'
9+
- '.github/workflows/build_linux.yml'
910
pull_request:
1011
branches: [ "main" ]
1112
paths:
@@ -31,6 +32,14 @@ jobs:
3132

3233
- name: Move compiled file
3334
run: mv ${{github.workspace}}/build/libserialport.so ${{github.workspace}}/lib/dls/
35+
36+
# - name: Commit artifact changes
37+
# run: |
38+
# git config --local user.email "action@github.com"
39+
# git config --local user.name "GitHub Action"
40+
# git add lib/dls/*
41+
# git commit -m "Add artifact"
42+
# git push
3443

3544
- name: Archive artifact
3645
uses: actions/upload-artifact@v3

.github/workflows/build_windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
paths:
77
- 'include/**'
88
- 'src/**'
9+
- '.github/workflows/build_windows.yml'
910
pull_request:
1011
branches: [ "main" ]
1112
paths:

.github/workflows/release.yml

Lines changed: 83 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,93 @@
1-
name: Release Binarys
2-
3-
permissions:
4-
contents: read
1+
---
2+
name: "Pre-Release"
53

64
on:
75
push:
8-
tags:
9-
- 'Release-v*'
6+
branches: [ "main" ]
7+
paths:
8+
- 'include/**'
9+
- 'src/**'
10+
- '.github/workflows/release.yml'
11+
pull_request:
12+
branches: [ "main" ]
13+
paths:
14+
- 'include/**'
15+
- 'src/**'
16+
17+
env:
18+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
19+
BUILD_TYPE: Release
1020

1121
jobs:
12-
release-binarys:
22+
build_linux:
1323
runs-on: ubuntu-latest
24+
1425
steps:
15-
- name: Validate Tag
16-
id: validate-tag
17-
18-
- name: Create Release
19-
id: create_release
20-
uses: actions/create-release@v1
21-
env:
22-
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
26+
- uses: actions/checkout@v3
27+
28+
- name: Configure CMake
29+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
30+
31+
- name: Build
32+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
33+
34+
- name: Archive artifact
35+
uses: actions/upload-artifact@v3
2336
with:
24-
tag_name: v${{ github.ref }}
25-
release_name: Release v${{ github.ref }}
26-
draft: false
27-
prerelease: false
37+
name: linux-binary
38+
path: ${{github.workspace}}/build/libserialport.so
39+
40+
build_windows:
41+
runs-on: windows-latest
42+
43+
steps:
44+
- uses: actions/checkout@v3
45+
46+
- name: Configure CMake
47+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
2848

29-
- name: Upload Asset
30-
id: upload_asset
31-
uses: actions/upload-release-asset@v1
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
- name: Build
50+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
51+
52+
- name: Archive artifact
53+
uses: actions/upload-artifact@v3
3454
with:
35-
upload_url: ${{ steps.create_release.outputs.upload_url }}
36-
asset_path: ${{ github.workspace }}/lib/dls/serialport.dll
37-
asset_name: serialport.dll
38-
asset_content_type: application/octet-stream
55+
name: windows-binary
56+
path: ${{github.workspace}}\build\Release\serialport.dll
57+
58+
pre-release:
59+
needs: [build_windows, build_linux]
60+
name: "Pre Release"
61+
runs-on: "ubuntu-latest"
62+
63+
steps:
64+
- uses: actions/checkout@v3
65+
66+
- name: Download artifacts
67+
uses: actions/download-artifact@v3
68+
with:
69+
path: ${{github.workspace}}/tmp
70+
71+
- name: Rename linux Binary
72+
run: mv ${{github.workspace}}/tmp/linux-binary/libserialport.so ${{github.workspace}}/lib/dls/linux.so
73+
74+
- name: Rename windows Binary
75+
run: mv ${{github.workspace}}/tmp/windows-binary/serialport.dll ${{github.workspace}}/lib/dls/windows.dll
76+
77+
- run: cd ${{github.workspace}}
78+
79+
- name: make .tar.gz file
80+
run: tar -czvf lib.tar.gz ./lib
81+
82+
- name: make .zip
83+
run: zip -r lib.zip ./lib
84+
85+
- uses: "marvinpinto/action-automatic-releases@latest"
86+
with:
87+
repo_token: "${{ secrets.RELEASE_TOKEN }}"
88+
automatic_release_tag: "latest"
89+
prerelease: true
90+
title: "Development Build"
91+
files: |
92+
lib.tar.gz
93+
lib.zip

0 commit comments

Comments
 (0)