|
13 | 13 | CONTAINER_CMD: docker |
14 | 14 | CONTAINER_NON_INTERACTIVE: true |
15 | 15 |
|
16 | | -# Required for pushing to ghcr.io |
| 16 | +# Required for pushing to ghcr.io and creating releases |
17 | 17 | permissions: |
18 | | - contents: read |
| 18 | + contents: write |
19 | 19 | packages: write |
20 | 20 |
|
21 | 21 | jobs: |
|
88 | 88 |
|
89 | 89 | - name: Package Validate |
90 | 90 | run: ./scripts/container.sh ./scripts/ci-cd/step_package_validate.sh --skip-srpm-rebuild |
| 91 | + |
| 92 | + - name: Upload SRPM artifact |
| 93 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 94 | + uses: actions/upload-artifact@v4 |
| 95 | + with: |
| 96 | + name: srpm |
| 97 | + path: build/packages/*.src.rpm |
| 98 | + retention-days: 1 |
| 99 | + |
| 100 | + # ============================================ |
| 101 | + # Release (only on push to main) |
| 102 | + # ============================================ |
| 103 | + release: |
| 104 | + runs-on: ubuntu-latest |
| 105 | + needs: package |
| 106 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 107 | + steps: |
| 108 | + - name: Checkout code |
| 109 | + uses: actions/checkout@v4 |
| 110 | + |
| 111 | + - name: Download SRPM artifact |
| 112 | + uses: actions/download-artifact@v4 |
| 113 | + with: |
| 114 | + name: srpm |
| 115 | + path: packages |
| 116 | + |
| 117 | + - name: Get version and generate release info |
| 118 | + id: release_info |
| 119 | + env: |
| 120 | + COMMIT_SHA: ${{ github.sha }} |
| 121 | + run: | |
| 122 | + VERSION=$(head -n1 VERSION.md) |
| 123 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 124 | + |
| 125 | + # Create a unique tag using version + short commit hash |
| 126 | + SHORT_SHA=$(echo "$COMMIT_SHA" | cut -c1-7) |
| 127 | + echo "tag=v${VERSION}+${SHORT_SHA}" >> $GITHUB_OUTPUT |
| 128 | + |
| 129 | + # Generate checksums |
| 130 | + cd packages |
| 131 | + sha256sum *.src.rpm > SHA256SUMS |
| 132 | + |
| 133 | + # Build release body with checksums embedded |
| 134 | + cd .. |
| 135 | + cat > release_body.md << EOF |
| 136 | + Release of Common Low Level Tracing Kit |
| 137 | + |
| 138 | + **Commit:** ${COMMIT_SHA} |
| 139 | + |
| 140 | + ## Install from SRPM |
| 141 | + \`\`\`bash |
| 142 | + rpmbuild --rebuild clltk-${VERSION}-*.src.rpm |
| 143 | + sudo dnf install ~/rpmbuild/RPMS/x86_64/clltk-*.rpm |
| 144 | + \`\`\` |
| 145 | + |
| 146 | + ## Checksums (SHA256) |
| 147 | + \`\`\` |
| 148 | + $(cat packages/SHA256SUMS) |
| 149 | + \`\`\` |
| 150 | + EOF |
| 151 | +
|
| 152 | + - name: Create Release |
| 153 | + uses: softprops/action-gh-release@v2 |
| 154 | + with: |
| 155 | + tag_name: ${{ steps.release_info.outputs.tag }} |
| 156 | + name: ${{ steps.release_info.outputs.version }} |
| 157 | + body_path: release_body.md |
| 158 | + files: | |
| 159 | + packages/*.src.rpm |
| 160 | + packages/SHA256SUMS |
0 commit comments