diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d20aac6b..10adbb586 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,14 +1,17 @@ name: CI on: - pull_request: + # pull_request: push: - branches: - - main + # branches: + # - main +env: + runs-on: ubuntu-20.04 + node-version: 18.x jobs: mix_test: - runs-on: ubuntu-20.04 + runs-on: ${{ env.runs-on }} env: MIX_ENV: test strategy: @@ -62,7 +65,12 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: ${{ env.node-version }} + - name: Cache npm dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('asssets/package-lock.json') }} - run: npm install --prefix assets - run: npm run --prefix assets lint - run: sudo apt-get install xvfb @@ -70,3 +78,24 @@ jobs: xvfb-run --auto-servernum npm run --prefix assets test env: CI: true + + assets: + needs: [check_assets] + runs-on: ${{ env.runs-on }} + # if: ${{ github.ref_name == 'main' }} + steps: + - uses: actions/checkout@v3 + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: ${{ env.node-version }} + - name: Install npm dependencies + run: npm ci --prefix assets + - name: Build assets + run: npm run build --prefix assets + - name: Push updated assets + id: push_assets + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Update assets + file_pattern: formatters