aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build-frontend.yml
blob: dedf67f3c85c60969ed856594104f67f54b35675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Build and Commit Frontend

on:
  push:
    branches:
      - master
      - development
      - 'ci-test*' # This will match any branch that starts with "ci-test"
    paths:
      - 'frontend/**'

jobs:
  build:
    permissions:
      contents: write
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Repo
      uses: actions/checkout@v2
    - name: Setup Flutter
      uses: subosito/flutter-action@v1
      with:
        flutter-version: '3.13.2'
    - name: Build Flutter Web
      run: |
        cd frontend
        flutter build web --base-href /app/
    - name: Set branch name
      id: vars
      run: echo "::set-output name=branch::frontend_build_${GITHUB_SHA}"
    - name: Commit and Push
      run: |
        git config --local user.email "action@github.com"
        git config --local user.name "GitHub Action"
        git add frontend/build/web
        git commit -m "Update frontend build" -a
        git checkout -b ${{ steps.vars.outputs.branch }}
        echo "Commit hash: ${GITHUB_SHA}"
        git push origin ${{ steps.vars.outputs.branch }}
    # - name: Create Pull Request
    #   uses: peter-evans/create-pull-request@v3
    #   with:
    #     title: "Update frontend build"
    #     body: "This PR updates the frontend build."
    #     branch: ${{ steps.vars.outputs.branch }}
    #     base: "master"