Skip to content

chore: update github actions, #5

chore: update github actions,

chore: update github actions, #5

name: Cache Flutter App Version
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Read version from pubspec.yaml
id: read-version
run: |
echo "VERSION=$(grep 'version:' pubspec.yaml | awk '{print $2}')" >> $GITHUB_ENV
- name: Restore version from cache
id: cache
uses: actions/cache@v2
with:
path: version
key: version-${{ env.VERSION }}-${{ runner.os }}
- name: Check if version is cached
run: |
if [ -f version/version.txt ]; then
echo "Version is cached: $(cat version/version.txt)"
else
echo "Version is not cached"
fi
- name: Save version to cache
run: |
echo "${{ env.VERSION }}" > version.txt
mkdir -p version
mv version.txt version/
if: steps.cache.outputs.cache-hit != 'true'
- name: Use cached version
if: steps.cache.outputs.cache-hit == 'true'
run: |
echo "Using cached version: $(cat version/version.txt)"