Skip to content

chore: update github actions, #23

chore: update github actions,

chore: update github actions, #23

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 "PREVIOUS_VERSION=$(grep 'version:' pubspec.yaml | awk '{print $2}')" >> $GITHUB_ENV
echo "UPDATED_VERSION=$(cat pubspec.yaml | grep 'version:' | awk '{print $2}')" >> $GITHUB_ENV
- name: Restore version from cache
uses: actions/cache@v2
id: restore-cache
with:
path: version
key: ${{ runner.os }}-version-${{ hashFiles('version/*') }}
- name: Generate and save random number
run: |
echo "random_number: $RANDOM" > version.txt
echo "Updated version file:"
cat version.txt
- name: Save updated content to cache
uses: actions/cache@v2
with:
path: version
key: ${{ runner.os }}-version-${{ hashFiles('version/*') }}
# - name: Use cached version
# if: steps.cache.outputs.cache-hit == 'true'
# run: |
# echo "Using cached version: $(cat version/version.txt)"