|
1 | | -name: Release Binarys |
2 | | - |
3 | | -permissions: |
4 | | - contents: read |
| 1 | +--- |
| 2 | +name: "Pre-Release" |
5 | 3 |
|
6 | 4 | on: |
7 | 5 | 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 |
10 | 20 |
|
11 | 21 | jobs: |
12 | | - release-binarys: |
| 22 | + build_linux: |
13 | 23 | runs-on: ubuntu-latest |
| 24 | + |
14 | 25 | 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 |
23 | 36 | 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}} |
28 | 48 |
|
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 |
34 | 54 | 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