mirror of
https://github.com/terrapkg/packages.git
synced 2026-06-04 02:42:19 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 628aea0af3 | |||
| 70314d8216 | |||
| 3d216224e9 | |||
| 8421a422fc | |||
| cb8ef5fd3b | |||
| 257d028dac | |||
| cc11a162ce |
@@ -4,15 +4,19 @@ name: Automatically build packages
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
|
# paths:
|
||||||
|
# - anda/**
|
||||||
|
# branches:
|
||||||
|
# - frawhide
|
||||||
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- anda/**
|
- anda/**
|
||||||
branches:
|
branches:
|
||||||
- frawhide
|
- frawhide
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- frawhide
|
|
||||||
merge_group:
|
merge_group:
|
||||||
|
paths:
|
||||||
|
- anda/**
|
||||||
branches:
|
branches:
|
||||||
- frawhide
|
- frawhide
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -44,6 +48,14 @@ jobs:
|
|||||||
packages: ${{ needs.manifest.outputs.build_matrix }}
|
packages: ${{ needs.manifest.outputs.build_matrix }}
|
||||||
publish: ${{ github.event_name == 'push' }}
|
publish: ${{ github.event_name == 'push' }}
|
||||||
|
|
||||||
|
automerge:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-24.04-arm
|
||||||
|
steps:
|
||||||
|
- name: Merge PR on Success Build
|
||||||
|
if: github.event.pull_request.commits == 1 && github.event.pull_request.user.login == 'raboneko'
|
||||||
|
run: gh pr merge ${{ github.event.number }} --admin --squash
|
||||||
|
|
||||||
appstream:
|
appstream:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -106,3 +118,69 @@ jobs:
|
|||||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
done
|
done
|
||||||
|
|
||||||
|
lintUpdate:
|
||||||
|
needs: manifest
|
||||||
|
runs-on: ubuntu-24.04-arm
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
container:
|
||||||
|
image: ghcr.io/terrapkg/builder:frawhide
|
||||||
|
options: --cap-add=SYS_ADMIN --privileged
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
ssh-key: ${{ secrets.SSH_AUTHENTICATION_KEY }}
|
||||||
|
|
||||||
|
- name: Install SSH signing key & Set up git repository
|
||||||
|
run: |
|
||||||
|
mkdir -p ${{ runner.temp }}
|
||||||
|
echo "${{ secrets.SSH_SIGNING_KEY }}" > ${{ runner.temp }}/signing_key
|
||||||
|
chmod 0700 ${{ runner.temp }}/signing_key
|
||||||
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
|
|
||||||
|
- name: Collect update scripts from last commit
|
||||||
|
id: last_commit_update_scripts
|
||||||
|
run: |
|
||||||
|
scripts=$(git diff-tree --no-commit-id --name-only HEAD -r | grep -E '/update\.rhai$' || true)
|
||||||
|
scripts=$(printf "%s" "$scripts" | tr '\n' ' ')
|
||||||
|
echo "upd_scripts=${scripts}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Run update scripts from last commit
|
||||||
|
if: steps.last_commit_update_scripts.outputs.upd_scripts != ''
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
pr_number="${{ github.event.pull_request.number }}"
|
||||||
|
for script in ${{ steps.last_commit_update_scripts.outputs.upd_scripts }}; do
|
||||||
|
echo "Running update script: $script"
|
||||||
|
dir=$(dirname "$script")
|
||||||
|
hcl="$dir/anda.hcl"
|
||||||
|
if [ ! -f "$hcl" ]; then
|
||||||
|
echo "Missing anda.hcl for $script"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
backup="$hcl.autobuild_upd_test.bak"
|
||||||
|
cp $hcl $backup
|
||||||
|
if ! grep -qE 'labels {' $hcl; then
|
||||||
|
sed -E '/rpm\s*{/i labels { autobuild_upd_test = 1 }' -i $hcl
|
||||||
|
else
|
||||||
|
sed -E '/labels\s*{/a autobuild_upd_test = 1' -i $hcl
|
||||||
|
fi
|
||||||
|
|
||||||
|
output=$(anda run "$script" -f autobuild_upd_test=1 2>&1) || status=$?
|
||||||
|
status=${status:-0}
|
||||||
|
echo "$output"
|
||||||
|
|
||||||
|
mv "$backup" "$hcl" # do we want to commit this too?
|
||||||
|
|
||||||
|
if echo "$output" | grep -q "ERROR" || [ "$status" -ne 0 ]; then
|
||||||
|
gh pr comment ${{ github.event.pull_request.number }} --body "Update script failed: $script\n\n\`\`\`\n$output\n\`\`\`"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
name: Update per branch
|
name: Update per branch
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "*/30 * * * *"
|
- cron: "*/30 * * * *"
|
||||||
@@ -50,7 +51,7 @@ jobs:
|
|||||||
git config user.email "raboneko@fyralabs.com"
|
git config user.email "raboneko@fyralabs.com"
|
||||||
git config gpg.format "ssh"
|
git config gpg.format "ssh"
|
||||||
git config user.signingkey "${{ runner.temp }}/signing_key"
|
git config user.signingkey "${{ runner.temp }}/signing_key"
|
||||||
msg="bump(branch): $(anda run andax/ci/update_commit_message.rhai)"
|
anda run andax/ci/update_pr.rhai -l scope=branch
|
||||||
git commit -S -a -m "$msg"
|
|
||||||
git push -u origin --all
|
|
||||||
fi
|
fi
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
name: Nightly Update
|
name: Nightly Update
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * *"
|
||||||
@@ -39,17 +40,7 @@ jobs:
|
|||||||
git config user.email "raboneko@fyralabs.com"
|
git config user.email "raboneko@fyralabs.com"
|
||||||
git config gpg.format "ssh"
|
git config gpg.format "ssh"
|
||||||
git config user.signingkey "${{ runner.temp }}/signing_key"
|
git config user.signingkey "${{ runner.temp }}/signing_key"
|
||||||
msg="bump(nightly): $(anda run andax/ci/update_commit_message.rhai)"
|
anda run andax/ci/update_pr.rhai -l scope=nightly
|
||||||
git commit -S -a -m "$msg"
|
|
||||||
git format-patch HEAD^
|
|
||||||
copy_over () {
|
|
||||||
git checkout $1
|
|
||||||
git apply *.patch || true
|
|
||||||
git add anda
|
|
||||||
git commit -S -a -m "$msg"
|
|
||||||
}
|
|
||||||
copy_over f43 || true
|
|
||||||
copy_over f42 || true
|
|
||||||
copy_over el10 || true
|
|
||||||
git push -u origin --all
|
|
||||||
fi
|
fi
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
name: Weekly Update
|
name: Weekly Update
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * *"
|
||||||
@@ -39,17 +40,7 @@ jobs:
|
|||||||
git config user.email "raboneko@fyralabs.com"
|
git config user.email "raboneko@fyralabs.com"
|
||||||
git config gpg.format "ssh"
|
git config gpg.format "ssh"
|
||||||
git config user.signingkey "${{ runner.temp }}/signing_key"
|
git config user.signingkey "${{ runner.temp }}/signing_key"
|
||||||
msg="bump(weekly): $(anda run andax/ci/update_commit_message.rhai)"
|
anda run andax/ci/update_pr.rhai -l scope=weekly
|
||||||
git commit -S -a -m "$msg"
|
|
||||||
git format-patch HEAD^
|
|
||||||
copy_over () {
|
|
||||||
git checkout $1
|
|
||||||
git apply *.patch || true
|
|
||||||
git add anda
|
|
||||||
git commit -S -a -m "$msg"
|
|
||||||
}
|
|
||||||
copy_over f43 || true
|
|
||||||
copy_over f42 || true
|
|
||||||
copy_over el10 || true
|
|
||||||
git push -u origin --all
|
|
||||||
fi
|
fi
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
name: Update
|
name: Update
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "*/10 * * * *"
|
- cron: "*/10 * * * *"
|
||||||
@@ -27,7 +28,7 @@ jobs:
|
|||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
|
|
||||||
- name: Run Update
|
- name: Run Update
|
||||||
run: anda update --excludes nightly=1 --excludes weekly=1 --excludes updbranch=1
|
run: anda update -e nightly=1 -e updbranch=1 -e weekly=0 -e weekly=1 -e weekly=2 -e weekly=3 -e weekly=4 -e weekly=5 -e weekly=6
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.AUTOUPDATE_GH_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.AUTOUPDATE_GH_TOKEN }}
|
||||||
RUST_BACKTRACE: full
|
RUST_BACKTRACE: full
|
||||||
@@ -39,17 +40,7 @@ jobs:
|
|||||||
git config user.email "raboneko@fyralabs.com"
|
git config user.email "raboneko@fyralabs.com"
|
||||||
git config gpg.format "ssh"
|
git config gpg.format "ssh"
|
||||||
git config user.signingkey "${{ runner.temp }}/signing_key"
|
git config user.signingkey "${{ runner.temp }}/signing_key"
|
||||||
msg="bump: $(anda run andax/ci/update_commit_message.rhai)"
|
anda run andax/ci/update_pr.rhai -l scope=auto
|
||||||
git commit -S -a -m "$msg"
|
|
||||||
git format-patch HEAD^
|
|
||||||
copy_over () {
|
|
||||||
git checkout $1
|
|
||||||
git apply *.patch || true
|
|
||||||
git add anda
|
|
||||||
git commit -S -a -m "$msg"
|
|
||||||
}
|
|
||||||
copy_over f43 || true
|
|
||||||
copy_over f42 || true
|
|
||||||
copy_over el10 || true
|
|
||||||
git push -u origin --all
|
|
||||||
fi
|
fi
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
import "anda::cfg" as cfg;
|
|
||||||
|
|
||||||
let cmd = `git status | sed -nE '/^\tmodified:/{s@^\tmodified:\s+@@;s@[^/]+$@@;p}' | sort -u`;
|
|
||||||
let filelist = sh(cmd, #{ "stdout": "piped" }).ctx.stdout.split('\n');
|
|
||||||
|
|
||||||
let modified_list = "";
|
|
||||||
for file in filelist {
|
|
||||||
if file.is_empty() { continue; }
|
|
||||||
let spec = cfg::load_file(`${file}/anda.hcl`).project.pkg.rpm.spec;
|
|
||||||
spec.pop(5); // remove `.spec` suffix
|
|
||||||
modified_list += `${spec} `;
|
|
||||||
}
|
|
||||||
print(modified_list[..modified_list.len()-1]);
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import "anda::cfg" as cfg;
|
||||||
|
|
||||||
|
fn pr(branch, dir, spec, scope) {
|
||||||
|
sh(`git checkout ${branch}`, #{});
|
||||||
|
if sh(`git stash apply`, #{}).ctx.rc != 0 {
|
||||||
|
sh(`git reset HEAD ${dir}`, #{});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if sh(`git commit -S -m "bump(${scope}): ${spec}" ${dir}`, #{}).ctx.rc != 0 {
|
||||||
|
sh(`git reset HEAD ${dir}`, #{});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sh(`gh pr create --title '[${branch}] bump(${scope}): ${spec}' --body 'Automatic bump from CI\n\nnosync'`, #{});
|
||||||
|
sh(`git reset --hard HEAD^`, #{});
|
||||||
|
}
|
||||||
|
|
||||||
|
let cmd = `git status | sed -nE '/^\tmodified:/{s@^\tmodified:\s+@@;s@[^/]+$@@;p}' | sort -u`;
|
||||||
|
let filelist = sh(cmd, #{ "stdout": "piped" }).ctx.stdout.split('\n');
|
||||||
|
|
||||||
|
for dir in filelist {
|
||||||
|
if dir.is_empty() { continue; }
|
||||||
|
let spec = cfg::load_file(`${dir}/anda.hcl`).project.pkg.rpm.spec;
|
||||||
|
spec.pop(5); // remove `.spec` suffix
|
||||||
|
if labels.scope == "branch" {
|
||||||
|
sh(`git commit -S -m "bump(${labels.scope}): ${spec}" ${dir}`, #{});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
sh(`git stash push -m "bump(${labels.scope}): ${spec}" -- ${dir}`, #{});
|
||||||
|
pr("frawhide", dir, spec, labels.scope);
|
||||||
|
pr("f43", dir, spec, labels.scope);
|
||||||
|
pr("f42", dir, spec, labels.scope);
|
||||||
|
pr("el10", dir, spec, labels.scope);
|
||||||
|
sh(`git stash drop`, #{});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user