Skip to content

chore: update github actions, #4

chore: update github actions,

chore: update github actions, #4

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 "::set-output name=version::$(grep 'version:' pubspec.yaml | awk '{print $2}')"
- name: Restore version from cache
id: cache
uses: actions/cache@v2
with:
path: version
key: version-${{ steps.read-version.outputs.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 "${{ steps.read-version.outputs.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)"