Repository navigation
ci: auto-build in COPR on release #548
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 all commits
Commits
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,54 @@ | ||
| name: Build in COPR | ||
|
|
||
| # On a published release, build the source RPM (version taken from the tag) | ||
| # in a Fedora container and submit it to COPR (thesapd/headsetcontrol), which | ||
| # builds the binary RPMs for the configured Fedora/EPEL chroots. | ||
| # | ||
| # Requires a repository secret COPR_API_TOKEN: the full contents of your | ||
| # COPR API config (from https://copr.fedorainfracloud.org/api/), i.e. the | ||
| # `[copr-cli]` block with login/username/token/copr_url. | ||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: "Release tag to build (e.g. 4.1.0)" | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| copr: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| TAG: ${{ github.event.release.tag_name || inputs.tag }} | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event.release.tag_name || inputs.tag }} | ||
|
|
||
| - name: Write COPR config | ||
| env: | ||
| COPR_CONFIG: ${{ secrets.COPR_API_TOKEN }} | ||
| run: | | ||
| mkdir -p copr-cfg | ||
| printf '%s' "$COPR_CONFIG" > copr-cfg/copr | ||
|
|
||
| - name: Build SRPM and submit to COPR | ||
| run: | | ||
| docker run --rm -v "$PWD":/src -w /src -e TAG fedora:latest \ | ||
| bash -euo pipefail -c ' | ||
| dnf install -y -q rpm-build rpmdevtools copr-cli | ||
| rpmdev-setuptree | ||
| # Inject the release version (Source0 tracks %{version}) | ||
| sed -i "s/^Version:.*/Version: ${TAG}/" headsetcontrol.spec | ||
| cp headsetcontrol.spec ~/rpmbuild/SPECS/ | ||
| spectool -g -R ~/rpmbuild/SPECS/headsetcontrol.spec | ||
| rpmbuild -bs ~/rpmbuild/SPECS/headsetcontrol.spec | ||
| mkdir -p ~/.config && cp /src/copr-cfg/copr ~/.config/copr | ||
| copr-cli build --nowait thesapd/headsetcontrol ~/rpmbuild/SRPMS/*.src.rpm | ||
| ' | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repository's normal release path will not invoke this workflow:
.github/workflows/release.ymlcreates the published release throughncipollo/release-actionusingsecrets.GITHUB_TOKEN(lines 88-101), and GitHub does not start subsequent workflows for events caused by that token (other than its documented dispatch exceptions). Consequently, pushing a normal version tag produces the GitHub release but never submits its SRPM to COPR; only a manually created release orworkflow_dispatchwill run this job. Trigger this from the tag/release workflow directly (or use an appropriate non-GITHUB_TOKENtrigger mechanism).Useful? React with 👍 / 👎.