Check linkedin/cruise-control updates #23
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: Check linkedin/cruise-control updates | |
on: | |
schedule: | |
- cron: '0 * * * *' | |
workflow_dispatch: | |
jobs: | |
check-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Get latest tag | |
id: latest_tag | |
run: | | |
# latest | |
latest_tag=$(curl -s https://api.github.com/repos/linkedin/cruise-control/tags | jq -r '.[0].name') | |
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT | |
- name: Get current tag | |
id: current_tag | |
run: | | |
# current | |
current_tag=$(grep lastTag .lastbuild | cut -d '=' -f 2) | |
echo "current_tag=$current_tag" >> $GITHUB_OUTPUT | |
- name: Check if exists changes | |
id: check_changes | |
run: | | |
# check changes | |
if [ ${{ steps.latest_tag.outputs.latest_tag }} != ${{ steps.current_tag.outputs.current_tag }} ]; then | |
echo "tag_changed=true" >> $GITHUB_OUTPUT | |
fi | |
# save file | |
echo "lastTag=$new_tag" > .lastbuild | |
- name: Update .lastbuild file | |
if: steps.check_changes.outputs.tag_changed == 'true' | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add .lastbuild | |
git commit -m "chore: update .lastbuid version" | |
git push origin HEAD:main |