diff --git a/.github/workflows/backport.yaml b/.github/workflows/backport.yaml new file mode 100644 index 0000000..76521c7 --- /dev/null +++ b/.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 diff --git a/.github/workflows/copr-build.yaml b/.github/workflows/copr-build.yaml new file mode 100644 index 0000000..023b1b7 --- /dev/null +++ b/.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 }} diff --git a/build.sh b/build.sh index 45327ac..2ab9439 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,13 @@ 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" COPR_PROJECT="zfs-aarch64" COPR_USERNAME="$(copr-cli whoami)"