Fusion enhancements #15
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
name: "build and push connector to dev tennant" | |
env: | |
SAIL_BASE_URL: ${{ secrets.FUSION_TEST_TENANT_BASE_URL }} | |
SAIL_CLIENT_ID: ${{ secrets.FUSION_CLIENT_ID }} | |
SAIL_CLIENT_SECRET: ${{ secrets.FUSION_CLIENT_SECRET }} | |
CLI_VERSION: "2.1.9" | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main # assuming you're using the 'main' branch; adjust if you use 'master' or another | |
workflow_dispatch: | |
jobs: | |
build_connector: | |
name: Build the connector | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the master branch request to run rsync | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
# Checkout the master branch request to run rsync | |
- name: Checkout PR branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- name: Run npm install and build connector | |
id: buildConnector | |
run: | | |
npm install | |
npm run pack-zip | |
- name: Extract version from package.json | |
run: | | |
echo "PACKAGE_VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV | |
echo "CONNECTOR_NAME=$(jq -r .name package.json)" >> $GITHUB_ENV | |
- name: set env vars | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
echo "STACK=${{ env.CONNECTOR_NAME }}" >> $GITHUB_ENV | |
elif [[ ${{ github.ref }} == refs/pull/* ]]; then | |
PR_NUMBER=$(echo ${{ github.ref }} | awk -F '/' '{print $3}') | |
echo "STACK=${{ env.CONNECTOR_NAME }}-$PR_NUMBER" >> $GITHUB_ENV | |
else | |
echo "STACK=${{ env.CONNECTOR_NAME }}-staging" >> $GITHUB_ENV | |
fi | |
- name: Download sailpoint-cli package | |
run: | | |
wget https://github.com/sailpoint-oss/sailpoint-cli/releases/download/${{ env.CLI_VERSION }}/sail_${{ env.CLI_VERSION }}_linux_amd64.deb | |
- name: Install sailpoint-cli | |
run: | | |
sudo dpkg -i sail_${{ env.CLI_VERSION }}_linux_amd64.deb | |
- name: Use sailpoint-cli to create new connector | |
run: | | |
sail conn create "${{ env.STACK }}" | |
- name: Use sailpoint-cli to upload new connector | |
run: | | |
set -e | |
sail conn upload -c "${{ env.STACK }}" -f ./dist/${{ env.CONNECTOR_NAME }}-${{ env.PACKAGE_VERSION }}.zip | |
- name: Run integration tests for connector | |
if: github.event_name == 'pull_request' | |
id: integrationTests | |
run: | | |
npm run test | |
# deploy connector if push to main branch | |
- name: Check version change | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: | | |
VERSION_CHANGED=$(git diff HEAD^ HEAD -- "package.json" | grep '\"version\"') | |
if [ -z "$VERSION_CHANGED" ]; then | |
echo "package.json version has not changed." | |
exit 1 | |
fi | |
- name: Get Commits since last Release | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
id: changes | |
uses: simbo/changes-since-last-release-action@v1 | |
- name: Create GitHub release | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: | | |
gh release create v${{ env.PACKAGE_VERSION }} \ | |
--title "Release v${{ env.PACKAGE_VERSION }}" \ | |
--notes "${{ steps.changes.outputs.log }}" \ | |
--target main \ | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload file to release | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: | | |
gh release upload v${{ env.PACKAGE_VERSION }} ./dist/${{ env.CONNECTOR_NAME }}-${{ env.PACKAGE_VERSION }}.zip --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |