-
Notifications
You must be signed in to change notification settings - Fork 3
Add release github actions #223
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
Open
stanek-michal
wants to merge
2
commits into
main
Choose a base branch
from
ci/release-gha
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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,51 @@ | ||
name: Prepare Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Release version (e.g., 0.6)" | ||
required: true | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
bump-version: | ||
name: Bump QUARK_VERSION and open PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: false | ||
|
||
- name: Create bump branch | ||
id: prep | ||
shell: bash | ||
run: | | ||
set -euo pipefail | ||
VERSION="${{ inputs.version }}" | ||
BRANCH="release/bump-v${VERSION}" | ||
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" | ||
git checkout -b "$BRANCH" | ||
# Update QUARK_VERSION to exact VERSION (no trailing 'a') | ||
perl -0777 -pe "s/(#define\s+QUARK_VERSION\s+")([^"]+)(")/\1${VERSION}\3/" -i quark.h | ||
echo "Updated quark.h to QUARK_VERSION=${VERSION}" | ||
git add quark.h | ||
git commit -m "release: bump QUARK_VERSION to ${VERSION}" | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
branch: ${{ steps.prep.outputs.branch }} | ||
title: "release: bump QUARK_VERSION to ${{ inputs.version }}" | ||
body: | | ||
This PR bumps QUARK_VERSION to `${{ inputs.version }}` in quark.h. | ||
|
||
After merging, push the release tag `v${{ inputs.version }}` to trigger the release workflow. | ||
commit-message: "release: bump QUARK_VERSION to ${{ inputs.version }}" | ||
base: ${{ github.ref_name }} | ||
labels: release | ||
|
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,217 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
workflow_dispatch: {} | ||
|
||
permissions: | ||
contents: write | ||
|
||
concurrency: | ||
group: release-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
TAG: ${{ github.ref_name }} | ||
|
||
jobs: | ||
build-glibc-amd64: | ||
name: Build linux-amd64-glibc | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Build with Docker (Ubuntu GNU) | ||
run: | | ||
make docker | ||
|
||
- name: Package artifacts | ||
shell: bash | ||
run: | | ||
set -euo pipefail | ||
PKG="quark-${TAG}-linux-amd64-glibc" | ||
ROOT="stage/${PKG}" | ||
mkdir -p "${ROOT}" | ||
make dist DESTDIR="${ROOT}" | ||
mkdir -p dist | ||
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" . | ||
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256" | ||
rm -rf "$ROOT" | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: quark-${{ env.TAG }}-linux-amd64-glibc | ||
path: | | ||
dist/quark-${{ env.TAG }}-linux-amd64-glibc.tar.gz | ||
dist/quark-${{ env.TAG }}-linux-amd64-glibc.tar.gz.sha256 | ||
|
||
build-glibc217-amd64: | ||
name: Build linux-amd64-glibc217 (CentOS 7) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Build with Docker (CentOS 7) | ||
run: | | ||
make centos7 | ||
|
||
- name: Package artifacts | ||
shell: bash | ||
run: | | ||
set -euo pipefail | ||
PKG="quark-${TAG}-linux-amd64-glibc217" | ||
ROOT="stage/${PKG}" | ||
mkdir -p "${ROOT}" | ||
make dist DESTDIR="${ROOT}" | ||
mkdir -p dist | ||
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" . | ||
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256" | ||
rm -rf "$ROOT" | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: quark-${{ env.TAG }}-linux-amd64-glibc217 | ||
path: | | ||
dist/quark-${{ env.TAG }}-linux-amd64-glibc217.tar.gz | ||
dist/quark-${{ env.TAG }}-linux-amd64-glibc217.tar.gz.sha256 | ||
|
||
build-glibc-arm64: | ||
name: Build linux-arm64-glibc | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Build with Docker (ARM64 cross-compile) | ||
run: | | ||
make docker-cross-arm64 | ||
|
||
- name: Package artifacts | ||
shell: bash | ||
run: | | ||
set -euo pipefail | ||
PKG="quark-${TAG}-linux-arm64-glibc" | ||
ROOT="stage/${PKG}" | ||
mkdir -p "${ROOT}" | ||
make dist DESTDIR="${ROOT}" | ||
mkdir -p dist | ||
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" . | ||
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256" | ||
rm -rf "$ROOT" | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: quark-${{ env.TAG }}-linux-arm64-glibc | ||
path: | | ||
dist/quark-${{ env.TAG }}-linux-arm64-glibc.tar.gz | ||
dist/quark-${{ env.TAG }}-linux-arm64-glibc.tar.gz.sha256 | ||
|
||
build-musl-amd64: | ||
name: Build linux-amd64-musl | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Build with Docker (Alpine musl) | ||
run: | | ||
make alpine | ||
|
||
- name: Package artifacts | ||
shell: bash | ||
run: | | ||
set -euo pipefail | ||
PKG="quark-${TAG}-linux-amd64-musl" | ||
ROOT="stage/${PKG}" | ||
mkdir -p "${ROOT}" | ||
make dist DESTDIR="${ROOT}" | ||
mkdir -p dist | ||
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" . | ||
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256" | ||
rm -rf "$ROOT" | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: quark-${{ env.TAG }}-linux-amd64-musl | ||
path: | | ||
dist/quark-${{ env.TAG }}-linux-amd64-musl.tar.gz | ||
dist/quark-${{ env.TAG }}-linux-amd64-musl.tar.gz.sha256 | ||
|
||
publish: | ||
name: Publish GitHub Release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-glibc-amd64 | ||
- build-glibc217-amd64 | ||
- build-glibc-arm64 | ||
- build-musl-amd64 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Verify QUARK_VERSION vs tag | ||
shell: bash | ||
run: | | ||
set -euo pipefail | ||
TAG="${TAG}" | ||
VER_TAG="${TAG#v}" | ||
BASE_VER=$(echo "$VER_TAG" | sed -E 's/-rc[0-9]+$//') | ||
HDR_VER=$(grep -E '^[[:space:]]*#define[[:space:]]+QUARK_VERSION' quark.h | sed -E 's/.*"([^"]+)".*/\1/') | ||
if [[ "$VER_TAG" == *-rc* ]]; then | ||
# For -rc tags, expect header to be BASE_VER with trailing 'a' | ||
if [[ "$HDR_VER" != "${BASE_VER}a" ]]; then | ||
echo "QUARK_VERSION ($HDR_VER) must be ${BASE_VER}a for RC tags ($TAG)" >&2 | ||
exit 1 | ||
fi | ||
else | ||
# For final releases, expect exact match and no trailing 'a' | ||
if [[ "$HDR_VER" != "$BASE_VER" ]]; then | ||
echo "QUARK_VERSION ($HDR_VER) must equal $BASE_VER for tag $TAG" >&2 | ||
exit 1 | ||
fi | ||
if [[ "$HDR_VER" == *a ]]; then | ||
echo "QUARK_VERSION ($HDR_VER) must not end with 'a' for final release" >&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
- name: Download all build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
merge-multiple: true | ||
|
||
- name: Generate combined SHA256SUMS | ||
shell: bash | ||
run: | | ||
set -euo pipefail | ||
cd dist | ||
sha256sum *.tar.gz > SHA256SUMS | ||
|
||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.TAG }} | ||
body_path: CHANGES | ||
draft: true | ||
prerelease: ${{ contains(env.TAG, '-rc') }} | ||
files: | | ||
dist/*.tar.gz | ||
dist/*.tar.gz.sha256 | ||
dist/SHA256SUMS |
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
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.
this one maybe can be removed, probably better to do this part manually