-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Daily COPR | ||
|
||
on: | ||
schedule: | ||
- cron: "30 6 * * 1-5" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update_rpm: | ||
runs-on: ubuntu-latest | ||
name: Update RPM | ||
env: | ||
UPDATE_STATUS: "current" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Update RPM | ||
run: | | ||
source ./scripts/update-rpm.sh | ||
echo "UPDATE_STATUS=$update_status" >> $GITHUB_ENV | ||
- uses: zyrouge/github-push-action@v1 | ||
if: ${{ env.UPDATE_STATUS == 'updated' }} | ||
with: | ||
commit-message: "build(github-actions): automated update [skip ci]" | ||
allow-empty-commit: false | ||
|
||
- name: Build on COPR | ||
if: ${{ env.UPDATE_STATUS == 'updated' }} | ||
env: | ||
COPR_WEBHOOK: ${{ secrets.COPR_WEBHOOK }} | ||
run: | | ||
curl -X POST $COPR_WEBHOOK |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
update_rpm() { | ||
local spec_file=./chromebook-linux-audio.spec | ||
|
||
local current_main_commit=$(grep '%global maincommit\s.*$' $spec_file | awk '{ print $3 }') | ||
local current_dep_commit=$(grep '%global depcommit\s.*$' $spec_file | awk '{ print $3 }') | ||
|
||
local new_main_commit=$(curl -s -H "Accept: application/vnd.github.VERSION.sha" "https://api.github.com/repos/WeirdTreeThing/chromebook-linux-audio/commits/HEAD") | ||
local new_dep_commit=$(curl -s -H "Accept: application/vnd.github.VERSION.sha" "https://api.github.com/repos/WeirdTreeThing/alsa-ucm-conf-cros/commits/HEAD") | ||
|
||
if [ "$current_main_commit" = "$new_main_commit" ] && [ "$current_dep_commit" = "$new_dep_commit" ]; then | ||
|
||
echo "No changes detected" | ||
else | ||
echo "Changes detected, updating RPM spec" | ||
|
||
sed -i -e "s/maincommit\s.*/maincommit $new_main_commit/" ./$spec_file | ||
sed -i -e "s/depcommit\s.*/depcommit $new_dep_commit/" ./$spec_file | ||
|
||
update_status="updated" | ||
fi | ||
} | ||
|
||
update_status="current" | ||
update_rpm |