This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
generated from JupiterOne-Archives/integration-template
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INT-8299: adding intgration project support
- Loading branch information
Showing
1 changed file
with
76 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,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 }} |