Skip to content

fix(translations): fix text translations after language change #62

fix(translations): fix text translations after language change

fix(translations): fix text translations after language change #62

name: Deploy to Firebase Hosting
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
inputs:
environment:
description: 'Choose an environment to deploy'
required: true
default: 'dev'
type: choice
options:
- dev
- beta
- prod
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_deploy:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: false
- name: Update package.json version
run: |
sed -i.bak "s|\"version\": \"[0-9\.]*\"|\"version\": \"${{ steps.gitversion.outputs.semVer }}\"|" package.json
- name: Update sw.js version
run: |
sed -i.bak "s|OpenSprinkler-v[0-9\.]*|OpenSprinkler-v${{ steps.gitversion.outputs.semVer }}|" www/sw.js
- name: Update ui-dom.js version
run: |
sed -E -i.bak "s|(_\( \"App Version\" \) \+ \": )[^\"]*\"|\1${{ steps.gitversion.outputs.semVer }}\"|" www/js/modules/ui-dom.js
- name: Update config.xml versions
run: |
# Update version attribute
sed -i.bak "s|version=\"[0-9\.]*\"|version=\"${{ steps.gitversion.outputs.semVer }}\"|" config.xml
# Calculate versionCode
major=${{ steps.gitversion.outputs.major }}
minor=${{ steps.gitversion.outputs.minor }}
patch=${{ steps.gitversion.outputs.patch }}
version_code=$((major * 10000 + minor * 100 + patch))
# Update versionCode attribute
sed -i.bak "s|versionCode=\"[0-9]*\"|versionCode=\"$version_code\"|" config.xml
# Update <string> element
sed -i.bak "s|<string>[0-9\.]*</string>|<string>${{ steps.gitversion.outputs.semVer }}</string>|" config.xml
- name: Cache Dependencies
id: cache_npm
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
if: steps.cache_npm.outputs.cache-hit != 'true'
run: npm install
- name: Build UI
run: npx grunt prepareFW
- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_OPENSPRINKLER_UI }}
projectId: opensprinkler-ui
target: ${{
github.event_name == 'workflow_dispatch' && (
github.event.inputs.environment == 'prod' && 'opensprinkler-ui' ||
github.event.inputs.environment == 'beta' && 'opensprinkler-betaui' ||
'opensprinkler-devui'
) || 'opensprinkler-devui' }}
channelId: ${{ github.event_name == 'push' && 'live' || '' }}