NAS-128883 / 24.10 / Porting jbof #15120
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: WebUI | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'tests/**' | |
pull_request: | |
branches: | |
- '**' | |
paths-ignore: | |
- 'tests/**' | |
jobs: | |
install: | |
name: Checkout and Install | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install | |
uses: ./.github/actions/prepare | |
check-files: | |
name: Check if translations only were changed | |
runs-on: ubuntu-latest | |
outputs: | |
translations-only: ${{ steps.determine-changes.outputs.translations-only }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Determine if only translations were changed | |
id: determine-changes | |
run: | | |
CHANGED_FILES=$(git diff --name-only HEAD~1 ${{ github.sha }}) | |
echo "Changed files:" | |
echo "$CHANGED_FILES" | |
TRANSLATIONS_ONLY="true" | |
for file in $CHANGED_FILES; do | |
if [[ "$file" != "src/assets/i18n/"* ]]; then | |
TRANSLATIONS_ONLY="false" | |
break | |
fi | |
done | |
echo "::set-output name=translations-only::$TRANSLATIONS_ONLY" | |
build: | |
name: Build | |
needs: [check-files, install] | |
runs-on: ubuntu-latest | |
if: ${{ needs.check-files.outputs.translations-only == 'false' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install | |
uses: ./.github/actions/prepare | |
- name: Build | |
run: yarn build:prod:aot | |
lint: | |
name: Validate code style | |
needs: [check-files, install] | |
runs-on: ubuntu-latest | |
if: ${{ needs.check-files.outputs.translations-only == 'false' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install | |
uses: ./.github/actions/prepare | |
- name: Generate default environment file | |
run: yarn run check-env | |
- name: Build | |
run: yarn lint | |
lint-translations: | |
name: Validate translation strings | |
needs: [install] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install | |
uses: ./.github/actions/prepare | |
- name: Validate | |
run: yarn run validate-translations | |
test: | |
name: Run tests | |
needs: [check-files, install] | |
runs-on: ubuntu-latest | |
if: ${{ needs.check-files.outputs.translations-only == 'false' }} | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install | |
uses: ./.github/actions/prepare | |
- name: Run tests | |
run: yarn test:pr | |
- if: ${{ env.CODECOV_TOKEN }} | |
name: Upload coverage to codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
name: webui | |
token: ${{ env.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
resort-strings: | |
name: Resort Strings and Commit if only translations were added | |
needs: [check-files, install] | |
runs-on: ubuntu-latest | |
if: ${{ needs.check-files.outputs.translations-only == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
fetch-depth: 1 | |
- name: Install | |
uses: ./.github/actions/prepare | |
- name: Extract Messages | |
run: yarn run extract | |
- name: Validate Translations | |
run: yarn run validate-translations | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name 'BugClerk' | |
git config --global user.email '[email protected]' | |
git pull origin ${{ github.head_ref }} --no-edit | |
git add src/assets/i18n | |
if ! git diff --quiet --cached; then | |
git commit -m "NAS-XXXXXX: Auto resort translation strings" | |
git push origin ${{ github.head_ref }} | |
else | |
echo "No changes to commit." | |
fi |