Merge pull request #1021 from Onlineberatung/OB-10872 #6090
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: FE build action | |
on: | |
pull_request: | |
branches: | |
- 'develop' | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- 'dockerImage.v.*' | |
jobs: | |
build: | |
name: Build & Release | |
if: "!contains(github.event.head_commit.author, '[email protected]')" | |
permissions: | |
checks: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: set env | |
run: | | |
echo BRANCH=$(echo -n "${GITHUB_REF#refs/heads/}") >> $GITHUB_ENV | |
if [ "${{ github.ref }}" = "refs/heads/staging" ]; then | |
echo ENV_NAME="staging" >> $GITHUB_ENV | |
else | |
echo ENV_NAME="prod" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: 'https://npm.pkg.github.com' | |
cache: 'npm' | |
- name: Load .env file | |
uses: xom9ikk/dotenv@v2 | |
with: | |
mode: ${{ env.ENV_NAME }} | |
- run: npm ci | |
- name: Run linters | |
uses: wearerequired/lint-action@v2 | |
with: | |
github_token: ${{ secrets.github_token }} | |
eslint: true | |
eslint_dir: ./src | |
eslint_extensions: js,ts,tsx | |
stylelint: true | |
stylelint_dir: ./src | |
stylelint_extensions: scss | |
prettier: true | |
- name: Run build | |
run: | | |
npm run build | |
- name: Run tests | |
run: | | |
echo "127.0.0.1 localhost" | sudo tee -a /etc/hosts | |
echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.conf | |
npm run test:build | |
- name: Bump version | |
if: startsWith(env.BRANCH,'release') == true | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
npm run release | |
- name: Push changes | |
if: startsWith(env.BRANCH,'release') == true | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{env.BRANCH}} | |
force: true | |
tags: true | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: cypress-videos | |
path: cypress/videos/ |