Browse Source

add github actions

main
Nicolas Massé 1 month ago
parent
commit
347b591957
  1. 48
      .github/workflows/backport.yaml
  2. 33
      .github/workflows/copr-build.yaml
  3. 7
      build.sh

48
.github/workflows/backport.yaml

@ -0,0 +1,48 @@
name: Backport Packages (Daily)
# Everyday at02:00 UTC
on:
schedule:
- cron: '0 2 * * *'
# Enables manual triggering of the workflow
workflow_dispatch:
# Grants the action write access to the repository
permissions:
contents: write
jobs:
update-packages:
runs-on: ubuntu-latest
# Defines the Fedora container for this job
container:
image: fedora:latest
steps:
# 1. Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# 2. Run the update script in the container
- name: Run update script
run: ./update.sh
# 4. Prepare and push changes (if any)
- name: Commit and push changes
run: |
# Configure git
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Add all changes
git add .
# Check if there are changes to commit
if ! git diff-index --quiet HEAD; then
echo "Changes detected. Committing and pushing..."
git commit -m "chore: Automatic package backport"
git push
else
echo "No changes to commit."
fi

33
.github/workflows/copr-build.yaml

@ -0,0 +1,33 @@
name: Trigger COPR Build
on:
# Trigger on push to main branch
#push:
# branches:
# - main
# Enables manual triggering of the workflow
workflow_dispatch:
jobs:
build-copr:
runs-on: ubuntu-latest
# Defines the Fedora container for this job
container:
image: fedora:latest
steps:
# 1. Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# 2. Install the 'copr-cli' dependency
- name: Install copr-cli
run: dnf install -y copr-cli
# 3. Run the build script
- name: Run COPR build script
run: ./build.sh
# Inject secrets into the container as environment variables
env:
COPR_CONFIG: ${{ secrets.COPR_CONFIG }}

7
build.sh

@ -2,6 +2,13 @@
set -Eeuo pipefail set -Eeuo pipefail
if [ ! -f "$HOME/.config/copr" && -n "$COPR_CONFIG" ]; then
echo "Copr configuration file not found. Injecting from environment variable..."
mkdir -p "$HOME/.config"
echo "$COPR_CONFIG" > "$HOME/.config/copr"
chmod 0600 "$HOME/.config/copr"
fi
GIT_REPOSITORY="https://github.com/nmasse-itix/zfs-aarch64.git" GIT_REPOSITORY="https://github.com/nmasse-itix/zfs-aarch64.git"
COPR_PROJECT="zfs-aarch64" COPR_PROJECT="zfs-aarch64"
COPR_USERNAME="$(copr-cli whoami)" COPR_USERNAME="$(copr-cli whoami)"

Loading…
Cancel
Save