Build act #31779
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
name: Build act | |
on: | |
schedule: | |
- cron: 0 * * * * | |
jobs: | |
check-latest-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Fetch upstream version | |
run: | | |
VERSION=`wget --header="Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -q -O - \ | |
https://api.github.com/repos/nektos/act/releases/latest \ | |
| python -c 'import sys, json; print(json.load(sys.stdin)["tag_name"][1:])'` | |
[[ -z "$VERSION" ]] && exit 1 | |
[[ "$VERSION" == *"-"* ]] && exit 0 | |
echo "UPSTREAM_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Update spec version to match upstream version | |
if: env.UPSTREAM_VERSION != '' | |
run: | | |
sed -i -r '/(Version:\s*).+/{s//\1'$UPSTREAM_VERSION'/;h};${x;/./{x;q0};x;q1}' act-cli.spec | |
- name: Set version if changed | |
if: env.UPSTREAM_VERSION != '' | |
run: | | |
git diff --quiet || echo "VERSION=$UPSTREAM_VERSION" >> $GITHUB_ENV | |
- name: Update changelog | |
if: env.VERSION != '' | |
run: | | |
CHANGELOG="* $(date +'%a %b %d %Y') Gonçalo Silva <[email protected]>\n- Update to $VERSION" | |
sed -i "/%changelog/a $CHANGELOG" act-cli.spec | |
- name: Commit | |
if: env.VERSION != '' | |
run: | | |
git config --global user.name "Gonçalo Silva" | |
git config --global user.email "[email protected]" | |
git commit -am "act $VERSION" | |
git push | |
- name: Build on Copr | |
if: env.VERSION != '' | |
env: | |
WEBHOOK_COPR: ${{ secrets.WEBHOOK_COPR }} | |
run: | | |
curl -X POST "$WEBHOOK_COPR/act-cli/" --retry 10 |