Files
chromebrew/.github/workflows/Updater.yml
chromebrew-actions[bot] 1829b8fc0e Update workflows and adjust variable in const.rb to fix updater workflow runs. (#12233)
* Fix env variable check in const.rb

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust workflows.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Remove since_last_remote_commit:true

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Handle Draft PRs.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Move manifest reporting section of PRs.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust inputs for generate PR workflow.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* workflow cleanup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add unbuilt updated pip packages to updates-2025-07-21-02-47

* Build on linux/386 to branch updates-2025-07-21-02-47.

* Updating package files for linux/386 to branch updates-2025-07-21-02-47.

* Updating package files for linux/amd64 to branch updates-2025-07-21-02-47.

* Updating package files for linux/arm/v7 to branch updates-2025-07-21-02-47.

* fixup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* ADjust PR title

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust branch name for automatic updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fixup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: satmandu <satmandu@users.noreply.github.com>
Co-authored-by: chromebrew-actions[bot] <chromebrew-actions[bot]@users.noreply.github.com>
Co-authored-by: Ed Reel <edreel@gmail.com>
2025-07-21 16:01:50 +00:00

120 lines
5.3 KiB
YAML

---
name: Generate Updates PR
on:
schedule:
- cron: '0 0 * * *' # Daily
workflow_dispatch:
env:
GH_TOKEN: ${{ secrets.CREW_PR_TOKEN }} # setting GH_TOKEN for the entire workflow
permissions: # Global permissions configuration starts here
actions: write
contents: write
packages: write
pull-requests: write # 'write' access to pull requests
jobs:
update-check:
if: ${{ github.repository_owner == 'chromebrew' }}
runs-on: ubuntu-24.04
outputs:
timestamp: ${{ steps.set-variables.outputs.TIMESTAMP }} # https://stackoverflow.com/a/75142892
update_branch_name: ${{ steps.set-variables.outputs.UPDATE_BRANCH_NAME }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4.5'
- name: Install Python pip
run: sudo apt install -y python3-pip
- name: Install ruby-libversion # Hopefully this will get added as an Ubuntu/Debian package so we don't have to do this manually.
working-directory: ${{ runner.temp }}
run: |
git clone --depth 1 -b 3.0.3 https://github.com/repology/libversion
cd libversion
mkdir build
cd build
cmake ..
make -j "$(nproc)"
sudo make install
sudo gem install ruby-libversion
- name: Set workflow & branch variables
id: set-variables
run: |
export TIMESTAMP="$(date -u +%F-%H-%M)"
export UPDATE_BRANCH_NAME="automatic-updates-${TIMESTAMP}"
echo "TIMESTAMP=${TIMESTAMP}" >> "$GITHUB_OUTPUT"
echo "UPDATE_BRANCH_NAME=${UPDATE_BRANCH_NAME}" >> "$GITHUB_OUTPUT"
- name: Git setup
env:
UPDATE_BRANCH_NAME: ${{ steps.set-variables.outputs.UPDATE_BRANCH_NAME }}
run: |
git pull && ( git checkout -b "${UPDATE_BRANCH_NAME}" || git checkout "${UPDATE_BRANCH_NAME}" )
- name: Check for updates in pip packages.
id: pip-update-checks
env:
UPDATE_BRANCH_NAME: ${{ steps.set-variables.outputs.UPDATE_BRANCH_NAME }}
run: |
LD_LIBRARY_PATH=/usr/local/lib ruby tools/update_python_pip_packages.rb
# Create a new branch with the updated package files only
# if there are updated packages. Otherwise exit early.
if [ -n "$(git status --porcelain)" ]; then
echo "Python pip packages were updated."
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git add -A
git commit -m "Add unbuilt updated pip packages to ${UPDATE_BRANCH_NAME}"
echo "PIP_UPDATED=true" >> "$GITHUB_OUTPUT"
else
echo "Python pip packages were not updated."
echo "PIP_UPDATED=false" >> "$GITHUB_OUTPUT"
fi
- name: Push pip package changes
if: ${{ steps.pip-update-checks.outputs.PIP_UPDATED == 'true' }}
uses: ad-m/github-push-action@master
with:
branch: ${{ steps.set-variables.outputs.UPDATE_BRANCH_NAME }}
- name: Check for updates in ruby gem packages.
id: gem-update-checks
env:
UPDATE_BRANCH_NAME: ${{ steps.set-variables.outputs.UPDATE_BRANCH_NAME }}
run: |
LD_LIBRARY_PATH=/usr/local/lib ruby tools/update_ruby_gem_packages.rb
# Create a new branch with the updated package files only
# if there are updated packages. Otherwise exit early.
if [ -n "$(git status --porcelain)" ]; then
echo "Ruby gem packages were updated."
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git add -A
git commit -m "Add unbuilt updated ruby gem packages to ${UPDATE_BRANCH_NAME}"
echo "GEM_UPDATED=true" >> "$GITHUB_OUTPUT"
else
echo "Ruby gem packages were not updated."
echo "GEM_UPDATED=false" >> "$GITHUB_OUTPUT"
fi
- name: Push ruby gem package changes
if: ${{ steps.gem-update-checks.outputs.GEM_UPDATED == 'true' }}
uses: ad-m/github-push-action@master
with:
branch: ${{ steps.set-variables.outputs.UPDATE_BRANCH_NAME }}
- name: Cancel if no updates
id: no-update-cancel
if: ${{ ( steps.pip-update-checks.outputs.PIP_UPDATED == 'false' ) && ( steps.gem-update-checks.outputs.GEM_UPDATED == 'false' ) }}
run: |
echo "PIP_UPDATED is ${{ steps.pip-update-checks.outputs.PIP_UPDATED }}."
echo "GEM_UPDATED is ${{ steps.gem-update-checks.outputs.GEM_UPDATED }}."
git checkout master && git branch -D "${{ steps.set-variables.outputs.UPDATE_BRANCH_NAME }}" && git push
# https://stackoverflow.com/a/75809743
gh run cancel "${{ github.run_id }}"
gh run watch "${{ github.run_id }}"
dispatch-build:
if: ${{ github.repository_owner == 'chromebrew' }}
runs-on: ubuntu-24.04
needs: update-check
env:
UPDATE_BRANCH_NAME: ${{ needs.update-check.outputs.update_branch_name }}
steps:
- name: gh_workflow_dispatch
run: gh workflow -R chromebrew/chromebrew run Build.yml -f branch="${UPDATE_BRANCH_NAME}"