feat: multi-repo release #90
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 }} | |
kernel_release: ${{ steps.build_package.outputs.kernel_release }} | |
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-${KERNEL_RELEASE}.tar.gz | |
sha256sum kernel-x86_64-${KERNEL_RELEASE}.tar.gz >> kernel-x86_64-${KERNEL_RELEASE}.tar.gz.sha256 | |
echo "image_name=kernel-x86_64-${KERNEL_RELEASE}.tar.gz" >> "$GITHUB_OUTPUT" | |
echo "image_hash=$(cat kernel-x86_64-${KERNEL_RELEASE}.tar.gz.sha256)" >> "$GITHUB_OUTPUT" | |
echo "kernel_release=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
- uses: actions/upload-artifact@v4 | |
id: upload-artifact | |
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: | |
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: | |
KERNEL_RELEASE: ${{ needs.build_kernel.outputs.kernel_release }} | |
IMAGE_HASH: ${{ needs.build_kernel.outputs.image_hash }} | |
IMAGE_NAME: ${{ needs.build_kernel.outputs.image_name }} | |
GH_TOKEN: ${{ secrets.ROBOT_TOKEN }} | |
# this is the robot's ssh key | |
ROBOT_KEY: ${{ secrets.ROBOT_KEY }} | |
ARTIFACT_URL: ${{ steps.upload-artifact.outputs.artifact_url }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
octokit.rest.repos.createDeployment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: context.sha, | |
environment: "staging", | |
required_contexts: [], | |
transient_environment: true, | |
payload: { | |
kernel_release: process.env.KERNEL_RELEASE, | |
image_hash: process.env.IMAGE_HASH, | |
image_name: process.env.IMAGE_NAME, | |
artifact_url: process.env.ARTIFACT_URL | |
} | |
}); | |
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" |