-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add the v1 composed release pipeline #61
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
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ff34137
feat: add release-version.yml
mairas 0e964c4
feat(build-deb): add release mode
mairas 6c4585e
feat: add stage-release.yml
mairas 9e09dcb
feat: add apt-publish.yml
mairas f46e82c
docs: add deb main.yml and release.yml examples
mairas e332bcb
fix(checks): run steps with pipefail
mairas 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,125 @@ | ||
| # Reusable APT publication: dispatches package-updated to an APT repository. | ||
| # | ||
| # channel: unstable — call from main.yml after stage-release.yml, passing its | ||
| # prerelease-tag. | ||
| # channel: stable — call from release.yml on `release: published`. The job | ||
| # skips pre-releases and requires a v<upstream>+<N> tag. | ||
| # | ||
| # Either way the release must carry assets, so a release staged without | ||
| # packages is never dispatched. | ||
| # | ||
| # The APT repository fetches the .deb assets from this repository's releases. | ||
|
|
||
| name: APT publish | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| channel: | ||
| description: 'unstable or stable' | ||
| required: true | ||
| type: string | ||
| apt-repository: | ||
| description: 'APT repository to dispatch to (e.g. halos-org/apt.halos.fi)' | ||
| required: true | ||
| type: string | ||
| apt-distro: | ||
| description: 'APT distribution (e.g. trixie, any)' | ||
| required: true | ||
| type: string | ||
| apt-component: | ||
| description: 'APT component (e.g. main, hatlabs)' | ||
| required: true | ||
| type: string | ||
| prerelease-tag: | ||
| description: 'Unstable channel: the pre-release tag from release-version.yml' | ||
| required: false | ||
| default: '' | ||
| type: string | ||
| runs-on: | ||
| description: 'Runner to use' | ||
| required: false | ||
| default: 'ubuntu-latest' | ||
| type: string | ||
| secrets: | ||
| APT_REPO_PAT: | ||
| description: 'Token allowed to send repository_dispatch to apt-repository' | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| # Run steps with -eo pipefail rather than the implicit bash -e. | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| apt-publish: | ||
| if: ${{ !(github.event_name == 'release' && github.event.release.prerelease) }} | ||
| runs-on: ${{ inputs.runs-on }} | ||
| env: | ||
| CHANNEL: ${{ inputs.channel }} | ||
| PRERELEASE_TAG: ${{ inputs.prerelease-tag }} | ||
| steps: | ||
| - name: Validate channel | ||
| env: | ||
| EVENT: ${{ github.event_name }} | ||
| run: | | ||
| case "$CHANNEL" in | ||
| unstable) | ||
| if [ -z "$PRERELEASE_TAG" ]; then | ||
| echo "::error::The unstable channel needs prerelease-tag" | ||
| exit 1 | ||
| fi | ||
| ;; | ||
| stable) | ||
| if [ "$EVENT" != release ]; then | ||
| echo "::error::The stable channel is published from a release event, not $EVENT" | ||
| exit 1 | ||
| fi | ||
| ;; | ||
| *) | ||
| echo "::error::channel must be unstable or stable, got '$CHANNEL'" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| - name: Verify release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RELEASE_TAG: ${{ github.event.release.tag_name }} | ||
| run: | | ||
| # Tag formats written by release-version.yml. | ||
| if [ "$CHANNEL" = stable ]; then | ||
| TAG=$RELEASE_TAG | ||
| PATTERN='^v([0-9][0-9A-Za-z.~-]*)\+([0-9]+)$' | ||
| else | ||
| TAG=$PRERELEASE_TAG | ||
| PATTERN='^v([0-9][0-9A-Za-z.~-]*)\+([0-9]+)_pre$' | ||
| fi | ||
| if ! [[ $TAG =~ $PATTERN ]]; then | ||
| echo "::error::Release tag '$TAG' does not match the $CHANNEL tag format" | ||
| exit 1 | ||
| fi | ||
| echo "Debian version: ${BASH_REMATCH[1]}-${BASH_REMATCH[2]}" | ||
| ASSET_COUNT=$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets | length') | ||
| if [ "$ASSET_COUNT" -eq 0 ]; then | ||
| echo "::error::Release $TAG has no assets; pass build-deb.yml's artifact output to stage-release.yml" | ||
| exit 1 | ||
| fi | ||
| echo "Release $TAG has $ASSET_COUNT asset(s)" | ||
|
|
||
| - name: Dispatch to APT repository | ||
| uses: peter-evans/repository-dispatch@v3 | ||
| with: | ||
| token: ${{ secrets.APT_REPO_PAT }} | ||
| repository: ${{ inputs.apt-repository }} | ||
| event-type: package-updated | ||
| client-payload: | | ||
| { | ||
| "repository": "${{ github.repository }}", | ||
| "distro": "${{ inputs.apt-distro }}", | ||
| "channel": "${{ inputs.channel }}", | ||
| "component": "${{ inputs.apt-component }}" | ||
| } | ||
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
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.