Rename connector (#83) #89
This file contains 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
# workflow to run both yarn && yarn build in the repo when pr is merged to main | |
name: Publish Connectors | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-publish: | |
# checkout the repo | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@chili-publish' | |
- name: Install dependencies | |
run: yarn | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_SECRET }} | |
- name: Download index.json | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
container_name="connector-marketplace" | |
blob_name="connector-repo/index.json" | |
destination_file="existing/index.json" | |
connection_string="${{ secrets.AZURE_ST_MARKETPLACE_DEV_CONNECTION_STRING }}" | |
# ensure 'existing' folder exists | |
mkdir -p existing | |
# Check if the blob exists | |
blob_exists=$(az storage blob exists --name $blob_name --container-name $container_name --connection-string $connection_string --output tsv --query exists) | |
# If the blob exists, download it | |
if [ $blob_exists == "true" ]; then | |
az storage blob download --name $blob_name --file $destination_file --container-name $container_name --connection-string $connection_string --no-progress | |
else | |
echo "Blob does not exist." | |
fi | |
- name: Determine changed connectors | |
run: | | |
if git rev-parse --verify HEAD^ >/dev/null 2>&1; then | |
echo "Diffing HEAD^ HEAD" | |
CHANGED_CONNECTOR=$(git diff --name-only HEAD^ HEAD | grep '^src/connectors/' | cut -d/ -f3 | sort | uniq) | |
else | |
echo "Diffing HEAD" | |
CHANGED_CONNECTOR=$(git diff --name-only HEAD | grep '^src/connectors/' | cut -d/ -f3 | sort | uniq) | |
fi | |
echo "Changed directories: $CHANGED_CONNECTOR" | |
echo "CHANGED_CONNECTOR=$CHANGED_CONNECTOR" >> $GITHUB_ENV | |
- name: Build Cli | |
run: yarn run build-cli | |
- name: Build and Publish connectors | |
if: env.CHANGED_CONNECTOR != '' | |
run: | | |
echo "Building and publishing $CHANGED_CONNECTOR" | |
node scripts/publish.js $CHANGED_CONNECTOR | |
- name: Copy to upload folder | |
if: env.CHANGED_CONNECTOR != '' | |
run: mkdir -p upload/connector-repo && cp -r publish/* upload/connector-repo | |
- name: Upload artifacts | |
if: env.CHANGED_CONNECTOR != '' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: connectors | |
path: upload/connector-repo | |
- name: Upload to Azure | |
if: env.CHANGED_CONNECTOR != '' | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az storage blob upload-batch -d connector-marketplace -s upload/ --connection-string "${{ secrets.AZURE_ST_MARKETPLACE_DEV_CONNECTION_STRING }}" --overwrite true |