v0.16.3-sable.1 #8
Workflow file for this run
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 & publish embedded packages for releases | |
| on: | |
| release: | |
| types: [published] | |
| pull_request: | |
| types: | |
| - synchronize | |
| - opened | |
| - labeled | |
| push: | |
| branches: [livekit] | |
| jobs: | |
| versioning: | |
| name: Versioning | |
| runs-on: ubuntu-latest | |
| outputs: | |
| DRY_RUN: ${{ steps.dry_run.outputs.DRY_RUN }} | |
| PREFIXED_VERSION: ${{ steps.prefixed_version.outputs.PREFIXED_VERSION }} | |
| UNPREFIXED_VERSION: ${{ steps.unprefixed_version.outputs.UNPREFIXED_VERSION }} | |
| TAG: ${{ steps.tag.outputs.TAG }} | |
| steps: | |
| - name: Calculate VERSION | |
| # We should only use the hard coded test value for a dry run | |
| run: echo "VERSION=${{ github.event_name == 'release' && github.event.release.tag_name || 'v0.0.0-pre.0' }}" >> "$GITHUB_ENV" | |
| - id: dry_run | |
| name: Set DRY_RUN | |
| # We perform a dry run for all events except releases. | |
| # This is to help make sure that we notice if the packaging process has become | |
| # broken ahead of a release. | |
| run: echo "DRY_RUN=${{ github.event_name != 'release' }}" >> "$GITHUB_OUTPUT" | |
| - id: prefixed_version | |
| name: Set PREFIXED_VERSION | |
| run: echo "PREFIXED_VERSION=${VERSION}" >> "$GITHUB_OUTPUT" | |
| - id: unprefixed_version | |
| name: Set UNPREFIXED_VERSION | |
| # This just strips the leading character | |
| run: echo "UNPREFIXED_VERSION=${VERSION:1}" >> "$GITHUB_OUTPUT" | |
| - id: tag | |
| # latest = a proper release | |
| # other = anything else | |
| name: Set tag | |
| run: | | |
| if [[ "${VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "TAG=latest" >> "$GITHUB_OUTPUT" | |
| elif [[ "${VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+\-rc\.[0-9]+$ ]]; then | |
| echo "TAG=rc" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "TAG=other" >> "$GITHUB_OUTPUT" | |
| fi | |
| build_element_call: | |
| needs: versioning | |
| uses: ./.github/workflows/build-element-call.yaml | |
| with: | |
| vite_app_version: embedded-${{ needs.versioning.outputs.PREFIXED_VERSION }} | |
| package: embedded | |
| secrets: | |
| SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
| SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
| SENTRY_URL: ${{ secrets.SENTRY_URL }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| publish_tarball: | |
| needs: [build_element_call, versioning] | |
| if: always() | |
| name: Publish tarball | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # required to upload release asset | |
| steps: | |
| - name: Determine filename | |
| run: echo "FILENAME_PREFIX=sable-call-embedded-${{ needs.versioning.outputs.UNPREFIXED_VERSION }}" >> "$GITHUB_ENV" | |
| - name: Download built artifact | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.workflow_run.id || github.run_id }} | |
| name: build-output-embedded | |
| path: ${{ env.FILENAME_PREFIX}} | |
| - name: Create Tarball | |
| run: tar --numeric-owner -cvzf ${{ env.FILENAME_PREFIX }}.tar.gz ${{ env.FILENAME_PREFIX }} | |
| - name: Create Checksum | |
| run: find ${{ env.FILENAME_PREFIX }} -type f -print0 | sort -z | xargs -0 sha256sum | tee ${{ env.FILENAME_PREFIX }}.sha256 | |
| - name: Upload | |
| if: ${{ needs.versioning.outputs.DRY_RUN == 'false' }} | |
| uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2 | |
| with: | |
| files: | | |
| ${{ env.FILENAME_PREFIX }}.tar.gz | |
| ${{ env.FILENAME_PREFIX }}.sha256 | |
| publish_npm: | |
| needs: [build_element_call, versioning] | |
| if: always() | |
| name: Publish NPM | |
| runs-on: ubuntu-latest | |
| outputs: | |
| ARTIFACT_VERSION: ${{ steps.artifact_version.outputs.ARTIFACT_VERSION }} | |
| permissions: | |
| contents: read | |
| id-token: write # Allow npm to authenticate as a trusted publisher | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Download built artifact | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.workflow_run.id || github.run_id }} | |
| name: build-output-embedded | |
| path: embedded/web/dist | |
| # n.b. We don't enable corepack here because we are using plain npm | |
| - name: Setup node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version-file: .node-version | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Publish npm | |
| working-directory: embedded/web | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| npm version ${{ needs.versioning.outputs.PREFIXED_VERSION }} --no-git-tag-version | |
| echo "ARTIFACT_VERSION=$(jq '.version' --raw-output package.json)" >> "$GITHUB_ENV" | |
| npm publish --provenance --access public --tag ${{ needs.versioning.outputs.TAG }} ${{ needs.versioning.outputs.DRY_RUN == 'true' && '--dry-run' || '' }} | |
| - id: artifact_version | |
| name: Output artifact version | |
| run: echo "ARTIFACT_VERSION=${{env.ARTIFACT_VERSION}}" >> "$GITHUB_OUTPUT" | |
| release_notes: | |
| needs: [versioning, publish_npm] | |
| if: always() | |
| name: Update release notes | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # to update release notes | |
| steps: | |
| - name: Log versions | |
| run: | | |
| echo "NPM: ${{ needs.publish_npm.outputs.ARTIFACT_VERSION }}" | |
| - name: Add release notes | |
| if: ${{ needs.versioning.outputs.DRY_RUN == 'false' }} | |
| uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2 | |
| with: | |
| append_body: true | |
| body: | | |
| ### NPM | |
| ``` | |
| npm install @sableclient/sable-call-embedded@${{ needs.publish_npm.outputs.ARTIFACT_VERSION }} | |
| ``` |