Skip to content

Check Version

Check Version #119

name: Check Version
on:
schedule:
# Schedule every 12 hours
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
outputs:
update: ${{ steps.jobOutput.outputs.update }}
steps:
- uses: actions/checkout@v2
- name: Get current version
run: |
echo "currentVersion=$(grep -m1 'version:' pubspec.yaml | awk '{print $2}')" >> $GITHUB_ENV
- name: print current version
run: |
echo "Current Version: ${{ env.currentVersion }}"
- name: Clone codelessly_starter_brick
run: |
rm -rf codelessly_starter_brick
git clone https://github.com/Codelessly/codelessly_starter_brick.git --single-branch
- name: Get Latest Version
run: |
echo "starterVersion=$(grep -m1 'version:' codelessly_starter_brick/__brick__/pubspec.yaml | awk '{print $2}')" >> $GITHUB_ENV
- name: print version
run: |
echo "Starter Version: ${{ env.starterVersion }}"
- name: Compare versions
run: |
if [ "${{ env.currentVersion }}" != "${{ env.starterVersion }}" ]; then
echo "Versions are different"
echo "update=true" >> $GITHUB_ENV
else
echo "Versions are the same"
echo "update=false" >> $GITHUB_ENV
fi
- name: print update
run: |
echo "Should Update: ${{ env.update }}"
- name: Set Job Output
id: jobOutput
run: echo "update=${{ env.update }}" >> "$GITHUB_OUTPUT"
update:
needs: check
uses: codelessly/codelessly-test-app/.github/workflows/update_repo.yaml@main
if: ${{ needs.check.outputs.update == 'true' }}
secrets: inherit