Skip to content

Update tc2-agent

Update tc2-agent #406

# Checkout all three branches, aggregate version info, and commit changes
# to each branch if any of the version information in any branch has changed.
name: aggregate-version-info
on: [push, workflow_dispatch]
env:
HAS_CHANGES: ${{ false }}
jobs:
aggregate-version-info:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: dev
ref: dev
- name: Checkout
uses: actions/checkout@v4
with:
path: prod
ref: prod
- name: Checkout
uses: actions/checkout@v4
with:
path: test
ref: test
- name: Checkout
uses: actions/checkout@v4
with:
repository: TheCacophonyProject/salt-version-info
path: salt-version-info
token: ${{ secrets.WRITE_VERSION_INFO_TOKEN }}
persist-credentials: true
- uses: actions/[email protected]
with:
node-version: 20.x
- name: Run version-check script
shell: bash
run: |
cd dev/.github/workflows
npm i
npm run aggregate-versions ${{ github.repository }}
- name: Check for new files
id: newFiles
shell: bash
working-directory: salt-version-info
run: |
git add -A
git status --porcelain | wc -l
if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
echo "HAS_CHANGES=true" >> "$GITHUB_ENV"
else
echo "HAS_CHANGES=false" >> "$GITHUB_ENV"
fi
- name: Push new files
if: env.HAS_CHANGES == 'true'
shell: bash
working-directory: salt-version-info
run: |
git config --global user.name "cacophony-bot"
git config --global user.email "[email protected]"
git commit -m "updated version information"
git push