|
24 | 24 | default: true |
25 | 25 | type: boolean |
26 | 26 |
|
| 27 | +permissions: |
| 28 | + contents: write |
| 29 | + packages: write |
| 30 | + |
27 | 31 | env: |
28 | 32 | BUILD_TYPE: ${{ github.event.inputs.build_type || 'Release' }} |
| 33 | + LIB_VERSION: ${{ github.event.inputs.version || '0.1.0' }} |
29 | 34 |
|
30 | 35 | jobs: |
31 | 36 | # Linux builds (x64 and ARM64) |
@@ -58,15 +63,11 @@ jobs: |
58 | 63 |
|
59 | 64 | - name: Configure version |
60 | 65 | run: | |
61 | | - if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then |
62 | | - echo "Setting version from workflow input: ${{ github.event.inputs.version }}" |
63 | | - sed -i "s/VERSION [0-9.]\+/VERSION ${{ github.event.inputs.version }}/" src/auth/CMakeLists.txt |
64 | | - else |
65 | | - echo "Using version from CMakeLists.txt" |
66 | | - fi |
| 66 | + # Use version from env variable (which comes from input or default) |
| 67 | + echo "Setting version to: ${{ env.LIB_VERSION }}" |
| 68 | + sed -i "s/VERSION [0-9.]\+/VERSION ${{ env.LIB_VERSION }}/" src/auth/CMakeLists.txt |
67 | 69 | VERSION=$(grep "project(gopher-mcp-auth VERSION" src/auth/CMakeLists.txt | sed -n 's/.*VERSION \([0-9.]\+\).*/\1/p') |
68 | 70 | echo "Building with version: $VERSION" |
69 | | - echo "LIB_VERSION=$VERSION" >> $GITHUB_ENV |
70 | 71 | |
71 | 72 | - name: Build library |
72 | 73 | run: | |
@@ -113,15 +114,11 @@ jobs: |
113 | 114 |
|
114 | 115 | - name: Configure version |
115 | 116 | run: | |
116 | | - if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then |
117 | | - echo "Setting version from workflow input: ${{ github.event.inputs.version }}" |
118 | | - sed -i "s/VERSION [0-9.]\+/VERSION ${{ github.event.inputs.version }}/" src/auth/CMakeLists.txt |
119 | | - else |
120 | | - echo "Using version from CMakeLists.txt" |
121 | | - fi |
| 117 | + # Use version from env variable (which comes from input or default) |
| 118 | + echo "Setting version to: ${{ env.LIB_VERSION }}" |
| 119 | + sed -i "s/VERSION [0-9.]\+/VERSION ${{ env.LIB_VERSION }}/" src/auth/CMakeLists.txt |
122 | 120 | VERSION=$(grep "project(gopher-mcp-auth VERSION" src/auth/CMakeLists.txt | sed -n 's/.*VERSION \([0-9.]\+\).*/\1/p') |
123 | 121 | echo "Building with version: $VERSION" |
124 | | - echo "LIB_VERSION=$VERSION" >> $GITHUB_ENV |
125 | 122 | |
126 | 123 | - name: Build library |
127 | 124 | run: | |
@@ -322,12 +319,13 @@ jobs: |
322 | 319 | - name: Generate release tag |
323 | 320 | id: tag |
324 | 321 | run: | |
325 | | - # Generate tag based on version and timestamp |
| 322 | + # Use the LIB_VERSION from the global env |
326 | 323 | VERSION="${{ env.LIB_VERSION }}" |
327 | 324 | TIMESTAMP=$(date +%Y%m%d-%H%M%S) |
328 | 325 | TAG="v${VERSION}-${TIMESTAMP}" |
329 | 326 | echo "tag=${TAG}" >> $GITHUB_OUTPUT |
330 | 327 | echo "Release tag: ${TAG}" |
| 328 | + echo "Version for release: ${VERSION}" |
331 | 329 | |
332 | 330 | - name: Create GitHub Release |
333 | 331 | uses: softprops/action-gh-release@v1 |
|
0 commit comments