Skip to content

Track upstream activity #695

Track upstream activity

Track upstream activity #695

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
name: Track upstream activity
jobs:
track-commits:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
token: ${{ secrets.PUSH_TOKEN }}
- name: Install dependencies
run: |
pip install packaging
- name: Update upstream code
run: |
git -C icestorm-src pull --ff-only origin master
git -C prjtrellis-src pull --ff-only origin master
git -C prjoxide-src pull --ff-only origin master
git -C nextpnr-src pull --ff-only origin master
python -c 'import urllib.request, json, packaging.version; print("Apycula==" + max(json.load(urllib.request.urlopen("https://pypi.org/pypi/Apycula/json"))["releases"], key=packaging.version.Version))' >apycula-meta/requirements.txt
- name: Push updated code
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update dependencies.
track-releases:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
token: ${{ secrets.PUSH_TOKEN }}
- name: Check out new upstream tag
id: checkout-tag
run: |
for tag in $(git -C nextpnr-src tag -l 'nextpnr-*' | sort -rV); do
ref=$(git -C nextpnr-src rev-parse $tag)
branch=develop-${tag/nextpnr-/}
if ! git rev-parse -q --verify remotes/origin/${branch} >/dev/null; then
echo "New branch ${branch} with nextpnr-src ${ref}"
git -C nextpnr-src checkout ${ref}
echo "version=${tag/nextpnr-/}" >> $GITHUB_OUTPUT
break
fi;
done
- name: Push new branch
uses: stefanzweifel/git-auto-commit-action@v5
if: steps.checkout-tag.outputs.version
with:
commit_message: "[autorelease] nextpnr ${{ steps.checkout-tag.outputs.version }}."
branch: develop-${{ steps.checkout-tag.outputs.version }}
create_branch: true
skip_dirty_check: true