feat: multi-repo release #78
This file contains 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
name: Build PR | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build_kernel: | |
runs-on: ubuntu-latest | |
container: | |
image: debian:latest | |
env: | |
SHA: ${{ github.event.pull_request.head.sha }} | |
VERSION: ${{ github.event.pull_request.head.ref }} | |
outputs: | |
image_hash: ${{ steps.build_package.outputs.image_hash }} | |
image_name: ${{ steps.build_package.outputs.image_name }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up okLinux environment | |
run: | | |
./deps | |
cd kernel | |
export CHROMEOS_KERNEL_FAMILY=termina | |
- name: Prepare kernel configuration | |
run: make olddefconfig | |
- name: Build kernel image | |
run: make -j$(nproc) bzImage | |
- name: Build Artifacts Package | |
id: build_package | |
run: | | |
cp arch/x86_64/boot/bzImage kernel-x86_64-${VERSION}.tar.gz | |
sha256sum kernel-x86_64-${SHA}.tar.gz >> kernel-x86_64-${SHA}.tar.gz.sha256 | |
echo "image_name=kernel-x86_64-${SHA}.tar.gz" >> "$GITHUB_OUTPUT" | |
echo "image_hash=$(cat kernel-x86_64-${SHA}.tar.gz.sha256)" >> "$GITHUB_OUTPUT" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: oklinux-kernel-x86_64-${{ github.event.pull_request.head.sha }} | |
path: kernel-x86_64-* | |
propose_release: | |
runs-on: ubuntu-latest | |
needs: build_kernel | |
steps: | |
- env: | |
VERSION: ${{ github.event.pull_request.head.ref }} | |
SHA: ${{ github.event.pull_request.head.sha }} | |
IMAGE_HASH: ${{ needs.build_kernel.outputs.image_hash }} | |
IMAGE_NAME: ${{ needs.build_kernel.outputs.image_name }} | |
uses: actions/checkout@v4 | |
with: | |
repository: "sevki/okLinux" | |
- name: make download-script | |
run: | | |
echo "curl -L https://api.github.com/repos/sevki/kernel/actions/artifacts/1330970479/${IMAGE_NAME} > ${IMAGE_NAME}" > download-kernel.sh | |
echo "sha256sum -c ${IMAGE_NAME}.sha256" >> download-kernel.sh | |
chmod +x download-kernel.sh | |
- name: create pull request | |
env: | |
VERSION: ${{ github.event.pull_request.head.ref }} | |
SHA: ${{ github.event.pull_request.head.sha }} | |
IMAGE_HASH: ${{ needs.build_kernel.outputs.image_hash }} | |
IMAGE_NAME: ${{ needs.build_kernel.outputs.image_name }} | |
GH_TOKEN: ${{ secrets.ROBOT_TOKEN }} | |
run: | | |
git config user.name okmachina | |
git config user.email 163742220+okmachina@users.noreply.github.com | |
git remote add okLinux "https://${{ secrets.ROBOT_TOKEN }}@github.com/sevki/okLinux.git" | |
git add download-kernel.sh | |
echo $IMAGE_HASH >> ${IMAGE_NAME}.sha256 | |
git add ${IMAGE_NAME}.sha256 | |
git commit -m "Update to${SHA}" | |
export COMMIT=$(git rev-parse HEAD) | |
git checkout -b "update-to-${SHA}" | |
git push okLinux "update-to-${SHA}" | |
gh pr create --title "Update to ${SHA}" --body "Update to ${SHA}" --base main --head "update-to-${SHA}" | |
build_kernel_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Setup okLinux environment | |
run: | | |
./docdeps | |
/usr/bin/python3 -m venv sphinx | |
. sphinx/bin/activate | |
pip install -r ./Documentation/sphinx/requirements.txt | |
make htmldocs | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "./Documentation/output" |