feat: tolgee platform client #15
This file contains hidden or 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: Publish client | |
| on: | |
| workflow_dispatch: | |
| workflow_run: | |
| workflows: ["Test"] | |
| branches: ["main"] | |
| types: | |
| - completed | |
| pull_request: | |
| jobs: | |
| publish-client: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: "${{ secrets.TOLGEE_MACHINE_PAT }}" | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| - name: Install node modules | |
| run: npm ci | |
| - name: Run get new version | |
| run: npm run release-dry | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GIT_AUTHOR_NAME: Tolgee Machine | |
| GIT_COMMITTER_NAME: Tolgee Machine | |
| GIT_AUTHOR_EMAIL: machine@tolgee.io | |
| GIT_COMMITTER_EMAIL: machine@tolgee.io | |
| - name: Set version property | |
| id: version | |
| run: echo "VERSION=$(test -e .VERSION && echo v$(cat .VERSION))" >> $GITHUB_OUTPUT | |
| - name: Start backend server | |
| uses: nick-fields/retry@v2 | |
| with: | |
| timeout_minutes: 30 | |
| max_attempts: ${{ github.event_name == 'push' && 5 || 1 }} | |
| command: | | |
| ./gradlew runDockerE2e -x buildWebapp | |
| - run: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/.npmrc | |
| # client folder | |
| - name: install npm dependencies | |
| run: npm install | |
| working-directory: ./client | |
| - name: Pull newest schema | |
| run: npm run schema | |
| working-directory: ./client | |
| - name: Publish to latest tag | |
| if: steps.version.outputs.VERSION != '' | |
| run: | | |
| VERSION=${{ steps.version.outputs.VERSION }} | |
| VERSION=${VERSION#v} # Remove 'v' prefix | |
| if npm view @tginternal/client@$VERSION versions --json >/dev/null 2>&1; then | |
| echo "Version $VERSION already exists, skipping publish." | |
| else | |
| npm run update-version -- $VERSION | |
| npm run build | |
| npm publish --tag latest | |
| fi | |
| working-directory: ./client | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish to prerelease tag | |
| if: steps.version.outputs.VERSION == '' | |
| run: | | |
| VERSION=0.0.0-prerelease.$(git rev-parse --short HEAD) | |
| if npm view @tginternal/client@$VERSION versions --json >/dev/null 2>&1; then | |
| echo "Version $VERSION already exists, skipping publish." | |
| else | |
| npm run update-version -- $VERSION | |
| npm run build | |
| npm publish --tag prerelease | |
| fi | |
| working-directory: ./client | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |