Merge pull request #10 from deandreamatias/update-setup-2024-06 #64
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build and test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure enviroment | |
uses: actions/checkout@v4 | |
- name: Get Flutter version by FVM | |
uses: kuhnroyal/flutter-fvm-config-action@v2 | |
id: fvm-config-action | |
with: | |
path: '.fvmrc' | |
- name: Download flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }} | |
cache: true | |
cache-key: 'flutter-:os:-:version:' | |
cache-path: '${{ runner.tool_cache }}/flutter/:os:-:version:' | |
- name: Retrieve the secret and decode it to a file | |
env: | |
ENV_PROD_BASE64: ${{ secrets.ENV_PROD_BASE64 }} | |
run: | | |
mkdir .env | |
echo $ENV_PROD_BASE64 | base64 -di > .env/prod.json | |
- name: Setup project | |
run: sh setup.sh | |
- name: Verify formated files | |
run: dart format . --set-exit-if-changed | |
- name: Analyze code | |
run: flutter analyze | |
- name: Build web | |
run: flutter build web --dart-define-from-file=.env/prod.json | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: web-app | |
path: build/web/ | |
retention-days: 1 | |
preview: | |
if: ${{ github.ref == 'refs/heads/main' }} | |
needs: build | |
name: Deploy preview web | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure enviroment | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: web-app | |
path: build/web | |
- name: HTML/CSS/JS Minifier | |
uses: docker://devatherock/minify-js:2.0.0 | |
with: | |
directory: 'build/web' | |
add_suffix: false | |
- uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: '${{ secrets.GITHUB_TOKEN }}' | |
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PELUQUERIA_MIMOS }}' | |
projectId: peluqueria-mimos | |
channelId: preview | |
deployment: | |
if: ${{ github.ref_type == 'tag' }} | |
needs: build | |
name: Deploy web | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure enviroment | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: web-app | |
path: build/web | |
- name: HTML/CSS/JS Minifier | |
uses: docker://devatherock/minify-js:2.0.0 | |
with: | |
directory: 'build/web' | |
add_suffix: false | |
- uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: '${{ secrets.GITHUB_TOKEN }}' | |
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PELUQUERIA_MIMOS }}' | |
projectId: peluqueria-mimos | |
channelId: live | |
- name: Release | |
uses: softprops/action-gh-release@v1 |