-
Notifications
You must be signed in to change notification settings - Fork 7
feat: release trains with semantic versioning and COPR RPM builds #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: COPR dependencies | ||
|
|
||
| # Dependency RPMs are pinned (see copr-deps/README.md) and published to | ||
| # quadsdev/qiip-deps once, not per qiip release. Run this on demand only | ||
| # when a dependency version is bumped; the qiip/qiip-dev COPR builds reuse | ||
| # the published RPMs as-is. | ||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: copr-deps | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build_deps: | ||
| name: Build and submit dependency RPMs | ||
| runs-on: ubuntu-latest | ||
| container: fedora:43 | ||
| if: github.repository == 'quadsproject/qiip' | ||
| steps: | ||
| - name: Install tooling | ||
| run: dnf -y install git make rpm-build python3-devel pyproject-rpm-macros python3-pip | ||
|
|
||
| - name: Check out repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
||
| - name: Work around GHA permission issue | ||
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
|
|
||
| - name: Setup COPR config | ||
| env: | ||
| API_TOKEN_CONTENT: ${{ secrets.COPR_API_TOKEN }} | ||
| run: | | ||
| umask 077 | ||
| mkdir -p "$HOME/.config" | ||
| echo "$API_TOKEN_CONTENT" > "$HOME/.config/copr" | ||
|
|
||
| - name: Fetch sdist sources | ||
| run: | | ||
| cd copr-deps | ||
| for spec in *.spec; do | ||
| version="$(awk '/^Version: /{print $2; exit}' "$spec")" | ||
| pkg="${spec%.spec}" | ||
| pip download --quiet --no-deps --no-binary=:all: "${pkg}==${version}" -d . | ||
| done | ||
|
|
||
| - name: Build SRPMs and submit to COPR | ||
| run: | | ||
| cd copr-deps | ||
| for spec in *.spec; do | ||
| rpmbuild -bs --define "_sourcedir $PWD" --define "_srcrpmdir $PWD" "$spec" | ||
| done | ||
| for srpm in *.src.rpm; do | ||
| echo "Submitting $srpm to quadsdev/qiip-deps" | ||
| copr build quadsdev/qiip-deps "$srpm" | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - development | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| # Serialize runs on the same branch, but never cancel: python-semantic- | ||
| # release pushes use GITHUB_TOKEN (which does not re-trigger workflows), | ||
| # and cancelling a running release run would drop its COPR submission. | ||
| group: release-${{ github.workflow }}-${{ github.ref }} | ||
|
|
||
| jobs: | ||
| # Only run release machinery when code (not docs/markdown/assets) changed | ||
| # since the last release. Message-level gating (fix:/feat: vs docs:/chore:) | ||
| # is python-semantic-release's job; this gate covers markdown-only commits. | ||
| gate: | ||
| name: Code-change gate | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| code_changed: ${{ steps.gate.outputs.code_changed }} | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Detect code changes since last release | ||
| id: gate | ||
| run: | | ||
| # On main, ignore vX.Y.Z-dev.N prerelease tags from the development | ||
| # train so the first development->main merge is treated as a release | ||
| # (its tree equals the dev-tagged tree). On development, dev tags are | ||
| # the right base and are used as-is. | ||
| case "$GITHUB_REF_NAME" in | ||
| main) extra="--exclude=*-dev.*";; | ||
| *) extra="";; | ||
| esac | ||
| last_tag="$(git describe --tags --abbrev=0 $extra 2>/dev/null || true)" | ||
| if [[ -z "$last_tag" ]]; then | ||
| # First release: treat everything as code until the first tag. | ||
| echo "code_changed=true" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| changed="$(git diff --name-only "$last_tag" HEAD -- . \ | ||
| ':(exclude)*.md' ':(exclude)docs/**' ':(exclude)assets/**')" | ||
| if [[ -n "$changed" ]]; then | ||
| echo "code_changed=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "Only docs/markdown/assets changed since $last_tag; skipping release" | ||
| echo "code_changed=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| semantic: | ||
| name: Semantic release | ||
| needs: gate | ||
| if: >- | ||
| needs.gate.outputs.code_changed == 'true' && | ||
| github.repository == 'quadsproject/qiip' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| outputs: | ||
| released: ${{ steps.psr.outputs.released }} | ||
| tag: ${{ steps.psr.outputs.tag }} | ||
| version: ${{ steps.psr.outputs.version }} | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Python semantic release | ||
| id: psr | ||
| uses: python-semantic-release/python-semantic-release@9a026e9303981c866c3425723009becb2437c757 # v10.6.2 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| copr_build: | ||
| name: COPR build | ||
| needs: semantic | ||
| if: >- | ||
| needs.semantic.outputs.released == 'true' && | ||
| github.repository == 'quadsproject/qiip' | ||
| runs-on: ubuntu-latest | ||
| container: fedora:43 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Install tooling | ||
| run: dnf -y install git @development-tools @rpm-development-tools \ | ||
| copr-cli make python3-devel pyproject-rpm-macros | ||
|
|
||
| - name: Check out release tag | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ needs.semantic.outputs.tag }} | ||
|
|
||
| - name: Work around GHA permission issue | ||
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
|
|
||
| - name: Setup COPR config | ||
| env: | ||
| API_TOKEN_CONTENT: ${{ secrets.COPR_API_TOKEN }} | ||
| run: | | ||
| umask 077 | ||
| mkdir -p "$HOME/.config" | ||
| echo "$API_TOKEN_CONTENT" > "$HOME/.config/copr" | ||
|
|
||
| - name: Build SRPM and submit to COPR | ||
| env: | ||
| PROJECT: ${{ github.ref_name == 'main' && 'qiip' || 'qiip-dev' }} | ||
| run: | | ||
| cd rpm | ||
| make srpm NAME="$PROJECT" | ||
| srpm_file="$(find . -name '*.src.rpm' -type f | head -n 1)" | ||
| if [[ -z "$srpm_file" ]]; then | ||
| echo "No .src.rpm found after 'make srpm'" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "Submitting $srpm_file to quadsdev/$PROJECT" | ||
| copr build "quadsdev/$PROJECT" "$srpm_file" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.