Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/npm-audio-package-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
description: 'Whether to publish as a latest build'
required: true
type: boolean
old-version-patch:
description: 'Whether to publish as a patch to an old version'
required: true
type: boolean

permissions:
id-token: write
Expand All @@ -28,7 +32,8 @@ jobs:
id-token: write
env:
AUDIO_API_DIR: packages/react-native-audio-api
AUDIO_API_VERSION: PLACEHOLDER
AUDIO_API_VERSION: PLACEHOLDER # all placeholders to be replaced during the run
TRUNKATED_VERSION: PLACEHOLDER
PACKAGE_NAME: PLACEHOLDER
TAG: PLACEHOLDER
steps:
Expand All @@ -50,17 +55,30 @@ jobs:
run: |
VERSION=$(jq -r .version package.json)
echo "AUDIO_API_VERSION=$VERSION" >> $GITHUB_ENV
TRUNKATED_VERSION=$(echo $VERSION | cut -d. -f1,2)
echo "TRUNKATED_VERSION=$TRUNKATED_VERSION" >> $GITHUB_ENV

- name: Assert AUDIO_API_VERSION
if: ${{ env.AUDIO_API_VERSION == 'PLACEHOLDER' }}
run: exit 1 # this should never happen

- name: Assert TRUNKATED_VERSION
if: ${{ env.TRUNKATED_VERSION == 'PLACEHOLDER' }}
run: exit 1 # this should never happen

- name: Install monorepo dependencies
run: yarn install --immutable

- name: Set tag
run: |
if [[ "${{ inputs.latest-build }}" != "true" ]]; then
if [[ "${{ inputs.old-version-patch }}" == "true" ]]; then
CURRENT_VERSION=$(npm view react-native-audio-api version | cut -d. -f1,2)
if [[ "$CURRENT_VERSION" == "${{ env.TRUNKATED_VERSION }}" ]]; then
echo "Old version patch requested but current published version matches package version. Exiting."
exit 1
fi
echo "TAG=rn-audio-api-${{ env.TRUNKATED_VERSION }}" >> $GITHUB_ENV
elif [[ "${{ inputs.latest-build }}" != "true" ]]; then
echo "TAG=audio-api-nightly" >> $GITHUB_ENV
else
echo "TAG=latest" >> $GITHUB_ENV
Expand All @@ -74,7 +92,7 @@ jobs:
id: build
working-directory: ${{ env.AUDIO_API_DIR }}
run: |
if [[ "${{ inputs.latest-build }}" != "true" ]]; then
if [[ "${{ inputs.latest-build }}" != "true" && "${{ inputs.old-version-patch }}" != "true"]]; then
./scripts/create-package.sh generate_nightly_version
else
./scripts/create-package.sh
Expand Down