Reputation: 327
I am working on github actions for ci/cd in flutter. The code is a subdirectory to the main repository folder. How would I run the github action in the subdirectory.
I am making use of the subosito flutter action
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter pub get
- run: flutter test
- run: flutter build appbundle
Upvotes: 3
Views: 873
Reputation: 10369
run
accepts a keyword named working-directory
. Just set it to the subdirectory and you're good to go. It's going to be something like this:
- run: flutter pub get
working-directory: your_subdirectory
- run: flutter test
working-directory: your_subdirectory
- run: flutter build appbundle
working-directory: your_subdirectory
It's also possible to set it per job (jobs.<job_id>.defaults.run) like so:
jobs:
job1:
runs-on: ubuntu-latest
defaults:
run:
working-directory: your_subdirectory
You can also use defaults.run
to set the default directory globally (for all jobs) as the subdirectory you expect. This way you'd remove a lot of repetition.
defaults:
run:
working-directory: your_subdirectory
Upvotes: 5