|
| 1 | +name: line_profiler RPMs |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + |
| 10 | +jobs: |
| 11 | + get_version: |
| 12 | + name: Get version info |
| 13 | + runs-on: ubuntu-latest |
| 14 | + permissions: |
| 15 | + contents: read |
| 16 | + defaults: |
| 17 | + run: |
| 18 | + shell: bash |
| 19 | + outputs: |
| 20 | + version: ${{ steps.spec_ver.outputs.version }} |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v6 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Get package version |
| 28 | + id: spec_ver |
| 29 | + run: | |
| 30 | + version=$(make version) |
| 31 | + echo "version=${version}" >> $GITHUB_OUTPUT |
| 32 | + echo Version from spec: $version |
| 33 | + env: |
| 34 | + NAME: python-line_profiler |
| 35 | + |
| 36 | + build_rpms: |
| 37 | + name: line_profiler-rpms |
| 38 | + timeout-minutes: 30 |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + matrix: |
| 42 | + name: [rocky9] |
| 43 | + include: |
| 44 | + - name: rocky9 |
| 45 | + spec: python-line_profiler |
| 46 | + image: quay.io/rockylinux/rockylinux:9 |
| 47 | + |
| 48 | + runs-on: ubuntu-latest |
| 49 | + needs: [get_version] |
| 50 | + container: |
| 51 | + image: ${{ matrix.image }} |
| 52 | + permissions: |
| 53 | + contents: read |
| 54 | + defaults: |
| 55 | + run: |
| 56 | + shell: bash |
| 57 | + env: |
| 58 | + PYTHONIOENCODING: utf-8 |
| 59 | + |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v6 |
| 62 | + with: |
| 63 | + fetch-depth: 0 |
| 64 | + |
| 65 | + # Work-around for https://github.com/actions/runner-images/issues/6775 |
| 66 | + - name: Change Owner of Container Working Directory |
| 67 | + if: matrix.image |
| 68 | + run: chown root.root . |
| 69 | + |
| 70 | + - name: Check version |
| 71 | + env: |
| 72 | + VERSION: ${{ needs.get_version.outputs.version }} |
| 73 | + run: | |
| 74 | + echo Dev version from get_version step: $VERSION |
| 75 | +
|
| 76 | + - name: Install deps for rpm builds (centos/rocky) |
| 77 | + run: | |
| 78 | + bash scripts/install_deps_el9.sh |
| 79 | +
|
| 80 | + - name: Build rpm pkgs |
| 81 | + run: | |
| 82 | + NAME="${{ matrix.spec }}" make packages |
| 83 | +
|
| 84 | + - name: Upload rpm files |
| 85 | + uses: actions/upload-artifact@v6 |
| 86 | + with: |
| 87 | + name: packages |
| 88 | + path: | |
| 89 | + tmp/RPMS/*/*.rpm |
| 90 | + tmp/SRPMS/*.rpm |
| 91 | +
|
| 92 | + create-release: |
| 93 | + name: Create line_profiler Release |
| 94 | + runs-on: ubuntu-latest |
| 95 | + needs: [get_version, build_rpms] |
| 96 | + permissions: |
| 97 | + contents: write |
| 98 | + steps: |
| 99 | + - name: Checkout |
| 100 | + uses: actions/checkout@v6 |
| 101 | + |
| 102 | + - name: Download Artifacts |
| 103 | + uses: actions/download-artifact@v7 |
| 104 | + with: |
| 105 | + name: packages |
| 106 | + path: packages |
| 107 | + |
| 108 | + - name: List Artifacts |
| 109 | + run: find . -maxdepth 3 -name \*.rpm |
| 110 | + |
| 111 | + - name: Fetch tags |
| 112 | + run: git fetch --tags --prune --quiet |
| 113 | + |
| 114 | + - name: Tag Release |
| 115 | + id: tag_release |
| 116 | + if: ${{ github.event_name != 'pull_request' }} |
| 117 | + run: | |
| 118 | + set +e |
| 119 | + if git rev-list "line_profiler-${{ needs.get_version.outputs.version }}" >/dev/null 2>&1 ; then |
| 120 | + echo "Tag for line_profiler-${{ needs.get_version.outputs.version }} already exists. Skipping release creation." |
| 121 | + echo "NEW_RELEASE=false" >> $GITHUB_OUTPUT |
| 122 | + else |
| 123 | + git tag "line_profiler-${{ needs.get_version.outputs.version }}" |
| 124 | + git push origin "line_profiler-${{ needs.get_version.outputs.version }}" |
| 125 | + echo "NEW_RELEASE=true" >> $GITHUB_OUTPUT |
| 126 | + fi |
| 127 | +
|
| 128 | + - name: Create draft release |
| 129 | + id: create_release |
| 130 | + if: ${{ github.event_name != 'pull_request' && steps.tag_release.outputs.NEW_RELEASE == 'true' }} |
| 131 | + uses: softprops/action-gh-release@v2 |
| 132 | + env: |
| 133 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 134 | + with: |
| 135 | + tag_name: line_profiler-${{ needs.get_version.outputs.version }} |
| 136 | + name: RPM Release line_profiler-${{ needs.get_version.outputs.version }} |
| 137 | + body: Latest RPMs for line_profiler-${{ needs.get_version.outputs.version }} |
| 138 | + draft: false |
| 139 | + prerelease: false |
| 140 | + files: | |
| 141 | + packages/RPMS/*/*.rpm |
| 142 | + packages/SRPMS/*.rpm |
0 commit comments