cherry-pick tc2-agent update #412
Workflow file for this run
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
# 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 | |