|
| 1 | +name: CI |
| 2 | + |
| 3 | +# --------------------------------------------------------------------------- |
| 4 | +# CI for itl-attestation-sdk |
| 5 | +# detect-version → lint + test + build wheel → auto-tag → GitHub Release |
| 6 | +# --------------------------------------------------------------------------- |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: [main, develop, "feature/**", "release/**", "hotfix/**"] |
| 10 | + pull_request: |
| 11 | + branches: [main, develop] |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: ci-${{ github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + |
| 20 | + detect-version: |
| 21 | + name: Detect version |
| 22 | + uses: ITlusions/ITL.Github/.github/workflows/_reusable-detect-version.yml@main |
| 23 | + with: |
| 24 | + tag-prefix: "v" |
| 25 | + |
| 26 | + ci: |
| 27 | + name: Lint / Test / Build |
| 28 | + needs: detect-version |
| 29 | + uses: ITlusions/ITL.Github/.github/workflows/_reusable-ci-python.yml@main |
| 30 | + with: |
| 31 | + python-version: "3.12" |
| 32 | + ref: ${{ github.sha }} |
| 33 | + artifact-name: "sdk-wheel" |
| 34 | + version: ${{ needs.detect-version.outputs.python-version }} |
| 35 | + ruff-src: "." |
| 36 | + test-path: "tests/" |
| 37 | + extra-install: "pip install -e .[dev]" |
| 38 | + |
| 39 | + build-meta: |
| 40 | + name: Compute build ID |
| 41 | + runs-on: ubuntu-latest |
| 42 | + outputs: |
| 43 | + build-id: ${{ steps.id.outputs.build-id }} |
| 44 | + steps: |
| 45 | + - name: Generate build ID |
| 46 | + id: id |
| 47 | + run: echo "build-id=$(date +%Y%m%d)-${{ github.run_number }}" >> "$GITHUB_OUTPUT" |
| 48 | + |
| 49 | + auto-tag: |
| 50 | + name: Auto-tag semver |
| 51 | + needs: ci |
| 52 | + if: | |
| 53 | + github.event_name == 'push' && |
| 54 | + ( |
| 55 | + github.ref == 'refs/heads/main' || |
| 56 | + startsWith(github.ref, 'refs/heads/release/') |
| 57 | + ) |
| 58 | + uses: ITlusions/ITL.Github/.github/workflows/_reusable-auto-tag.yml@main |
| 59 | + with: |
| 60 | + commit-sha: ${{ github.sha }} |
| 61 | + tag-prefix: "v" |
| 62 | + secrets: |
| 63 | + gh-pat: ${{ secrets.GH_PAT }} |
| 64 | + |
| 65 | + create-release: |
| 66 | + name: Create GitHub Release |
| 67 | + needs: [auto-tag, build-meta] |
| 68 | + if: | |
| 69 | + github.event_name == 'push' && |
| 70 | + ( |
| 71 | + github.ref == 'refs/heads/main' || |
| 72 | + startsWith(github.ref, 'refs/heads/release/') |
| 73 | + ) |
| 74 | + uses: ITlusions/ITL.Github/.github/workflows/_reusable-release-gh.yml@main |
| 75 | + with: |
| 76 | + tag: ${{ needs.auto-tag.outputs.tag }} |
| 77 | + artifact-name: "sdk-wheel" |
| 78 | + artifact-run-id: ${{ github.run_id }} |
| 79 | + generate-release-notes: true |
| 80 | + body: | |
| 81 | + ## Installation |
| 82 | +
|
| 83 | + **From PyPI** |
| 84 | + ```bash |
| 85 | + pip install itl-attestation-sdk==${{ needs.detect-version.outputs.python-version }} |
| 86 | + ``` |
| 87 | +
|
| 88 | + **From GitHub (this release)** |
| 89 | + ```bash |
| 90 | + pip install "itl-attestation-sdk @ https://github.com/${{ github.repository }}/releases/download/${{ needs.auto-tag.outputs.tag }}/$(ls dist/*.whl | xargs basename)" |
| 91 | + ``` |
| 92 | +
|
| 93 | + **From source** |
| 94 | + ```bash |
| 95 | + git clone https://github.com/${{ github.repository }}.git |
| 96 | + cd ITL.ControlPlane.Attestation.Sdk |
| 97 | + pip install . |
| 98 | + ``` |
| 99 | +
|
| 100 | + --- |
| 101 | + **Build:** ${{ needs.build-meta.outputs.build-id }} |
| 102 | + **Commit:** ${{ github.sha }} |
| 103 | + **Workflow run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 104 | + secrets: |
| 105 | + gh-pat: ${{ secrets.GH_PAT }} |
0 commit comments