Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
INT-8299: adding intgration project support
Browse files Browse the repository at this point in the history
  • Loading branch information
sl45082 committed May 12, 2023
1 parent a34e7dc commit 4ad0520
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/integration-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: J1 Google Cloud Integration deployment

on:
release:
types:
- published

jobs:
j1-integration-deployment:
runs-on: ubuntu-latest
steps:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Get graph project, integration name and version number
id: set_constants
uses: actions/[email protected]
with:
script: |
const tagName = context.payload.release.tag_name
const versionNumber = tagName.replace("v", "")
core.setOutput('versionNumber', versionNumber)
core.setOutPut('integrationName', 'integration-google-cloud')
core.setOutPut('graphProjectName', 'google-cloud')
- name: Clone integration-google-cloud repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }}
repository: JupiterOne/${{ steps.set_constants.outputs.integrationName }}
ref: main
path: './${{ steps.set_constants.outputs.integrationName }}'
- name: Set git config
shell: bash
working-directory: ./${{ steps.set_constants.outputs.integrationName }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "j1-internal-automation"
- name: Clean up and create branch
shell: bash
working-directory: ./${{ steps.set_constants.outputs.integrationName }}
run: |
git reset --hard
git checkout -b deploy-${{ steps.set_constants.outputs.integrationName }}-${{ steps.set_constants.outputs.versionNumber }}
git push origin deploy-${{ steps.set_constants.outputs.integrationName }}-${{ steps.set_constants.outputs.versionNumber }}
- name: Bump version in package.json and commit changes
shell: bash
working-directory: ./${{ steps.set_constants.outputs.integrationName }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > .npmrc
yarn
yarn upgrade @jupiterone/graph-${{ steps.set_constants.outputs.graphProjectName || steps.set_constants.outputs.integrationName }}@^${{ steps.set_constants.outputs.versionNumber }}
git add .
git commit -m "bump ${{ steps.set_constants.outputs.integrationName }} to version ${{ steps.set_constants.outputs.versionNumber }} deploy2dev"
- name: Create Pull Request
id: create_pull_request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }}
path: ./${{ steps.set_constants.outputs.integrationName }}
branch: deploy-${{ steps.set_constants.outputs.integrationName }}-${{ steps.set_constants.outputs.versionNumber }}
base: main
title: "[Github Action][${{ steps.set_constants.outputs.integrationName }}] - Deploy graph-${{ steps.set_constants.outputs.graphProjectName || steps.set_constants.outputs.integrationName }} v${{ steps.set_constants.outputs.versionNumber }}"
body: |
## Summary
${{ github.event.release.body }}
Pull request created by [Github action](integration-deployment.yml).
PR to bump the version ${{ steps.set_constants.outputs.versionNumber }} for the integration ${{ steps.set_constants.outputs.integrationName }}
- name: Enable Automerge
if: steps.create_pull_request.outputs.pull-request-operation == 'created'
shell: bash
run: gh pr merge --squash --auto "${{ steps.create_pull_request.outputs.pull-request-url }}"
env:
GH_TOKEN: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }}

0 comments on commit 4ad0520

Please sign in to comment.