Skip to content
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

feat: multi-repo release #40

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 51 additions & 7 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ jobs:
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@v2
uses: actions/checkout@v4
- name: Set up okLinux environment
run: |
./deps
Expand All @@ -28,11 +33,50 @@ jobs:

- 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-${SHA}.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: x86_64
path: arch/x86_64
- uses: actions/upload-artifact@v4
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:
name: bzImage
path: arch/x86_64/boot/bzImage
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}"
78 changes: 64 additions & 14 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,78 @@ jobs:
runs-on: ubuntu-latest
container:
image: debian:latest

env:
SHA: ${{ github.event.pull_request.head.sha }}
VERSION: ${{ github.event.pull_request.head.ref }}
GH_TOKEN: ${{ secrets.ROBOT_TOKEN }}
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 }}
artifact_url: ${{ steps.upload-artifact.outputs.artifact-url }}
arrifact_id: ${{ steps.upload-artifact.outputs.artifact-id }}
kernel_version: ${{ steps.build_package.outputs.kernel_version }}
GH_TOKEN: ${{ secrets.ROBOT_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up okLinux environment
run: |
./deps
./install_deps.sh
cd kernel
export CHROMEOS_KERNEL_FAMILY=termina
- name: Prepare kernel configuration
run: make olddefconfig

- name: Build kernel image
run: make -j$(nproc) bzImage
- uses: actions/upload-artifact@v4
with:
name: x86_64
path: arch/x86_64
- uses: actions/upload-artifact@v4
run: make -j$(nproc) targz-pkg
- name: Build Artifacts Package
id: build_package
run: |
export KERNEL_VERSION=$(cat version.txt)
export KERNEL_RELEASE="${KERNEL_VERSION}-${SHA}"
export FILENAME="oklinux-kernel-x86_64-${KERNEL_RELEASE}.tar.gz"
cp linux-${KERNEL_VERSION}-x86.tar.gz $FILENAME
sha256sum $FILENAME > $FILENAME.sha256
echo "image_name=$FILENAME" > "$GITHUB_OUTPUT"
echo "image_hash=$(cat ${FILENAME}.sha256)" >> "$GITHUB_OUTPUT"
echo "kernel_release=${KERNEL_RELEASE}" >> "$GITHUB_OUTPUT"
echo "kernel_version=${KERNEL_VERSION}" >> "$GITHUB_OUTPUT"
curl -X POST \
--data-binary @$FILENAME \
oknotok.computer/$FILENAME \
-H "authorization: bearer ${GH_TOKEN}" \
-H "x-image-sha: $(cat ${FILENAME}.sha256)" \
-H "x-commit: ${SHA}"
propose_release:
runs-on: ubuntu-latest
needs: build_kernel
steps:
- name: create pull request
env:
KERNEL_RELEASE: ${{ needs.build_kernel.outputs.kernel_release }}
KERNEL_VERSION: ${{ needs.build_kernel.outputs.kernel_version }}
IMAGE_HASH: ${{ needs.build_kernel.outputs.image_hash }}
IMAGE_NAME: ${{ needs.build_kernel.outputs.image_name }}
GH_TOKEN: ${{ secrets.ROBOT_TOKEN }}
ARTIFACT_URL: ${{ needs.build_kernel.outputs.artifact_url }}
uses: actions/github-script@v7
with:
name: bzImage
path: arch/x86_64/boot/bzImage
script: |
github.rest.repos.createDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.sha,
environment: `oklinux-${process.env.KERNEL_VERSION}-staging`,
required_contexts: [],
transient_environment: true,
payload: {
kernel_release: process.env.KERNEL_RELEASE,
kernel_version: process.env.KERNEL_VERSION,
image_hash: process.env.IMAGE_HASH,
image_name: process.env.IMAGE_NAME,
artifact_url: 'https://oknotok.computer/' + process.env.IMAGE_NAME,
}
});

build_kernel_docs:
runs-on: ubuntu-latest
steps:
Expand All @@ -48,4 +98,4 @@ jobs:
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './Documentation/output'
path: "./Documentation/output"
1 change: 0 additions & 1 deletion .github/workflows/publlsh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up okLinux environment
if: ${{ steps.release.outputs.release_created }}
run: |
./deps
cd kernel
Expand Down
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
make x86_64_defconfig
make -j$(nproc) targz-pkg
File renamed without changes.
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.6.22
6.6.21
Loading