-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2bb7a2
commit c24e79c
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# workflow to run both yarn && yarn build in the repo when pr is merged to main | ||
name: Publish Connectors | ||
|
||
on: | ||
push: | ||
branches: | ||
- test/fix-publish | ||
|
||
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_CDN_STUDIO_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 |
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