feat: cache runtime camera stream URL in FiveMClient #29
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: Build and Publish Package | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ 'v*' ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.28.0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://npm.pkg.github.com' | |
| scope: '@ghosttypes' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - name: Set version | |
| id: set_version | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
| # If this is a tag push, use the tag version | |
| TAG=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG#v} | |
| else | |
| # If this is not a tag push, use the current version and add timestamp | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| TIMESTAMP=$(date +%Y%m%d%H%M%S) | |
| VERSION="${CURRENT_VERSION}-${TIMESTAMP}" | |
| fi | |
| echo "Using version: $VERSION" | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| if [[ "$CURRENT_VERSION" != "$VERSION" ]]; then | |
| pnpm version $VERSION --no-git-tag-version | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Publish to GitHub Packages | |
| run: pnpm publish --no-git-checks | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Report error details if failed | |
| if: failure() | |
| run: | | |
| echo "::error::Package publish failed. Please check authentication and configuration." | |
| echo "::group::PNPM Config" | |
| pnpm config list | |
| echo "::endgroup::" | |
| echo "::group::Repository Info" | |
| echo "Owner: ${{ github.repository_owner }}" | |
| echo "Repo: ${{ github.repository }}" | |
| echo "::endgroup::" |