Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/publish_main_gpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish to GitHub Package Registry

on:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Fetch all tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Setup NodeJS Runtime
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
scope: '@intercom'

- name: Publish new tag
run: |
package_version="v$(node -e "console.log(require('./package.json').version)")"
tag_existed_before=$(git tag --list | grep "$package_version" | wc -l)
if [ "$tag_existed_before" == "0" ]; then
git config --global user.email "intercom-gpr-reader@intercom.com"
git config --global user.name "intercom/github-action-workflows - Auto-Tag - GitHub Action"
git tag -a "$package_version" -m "$package_version"
git push origin "$package_version"
echo "Pushed tag $package_version"
else
echo "Tag $package_version already exists, not overwriting"
fi

- name: Publish to GPR
run: rm .npmrc || true; npm publish || true
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/publish_pre_release_gpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish pre-release version to GitHub Package Registry

on:
push:
branches-ignore:
- main

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Fetch all tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Setup NodeJS Runtime
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
scope: '@intercom'

- name: Check version changes
run: echo "##[set-output name=is-pre-release;]$(node -e 'console.log(require(`./package.json`).version.includes(`-`))')"
id: package-version-check

- name: Publish new tag
if: steps.package-version-check.outputs.is-pre-release == 'true'
run: |
package_version="v$(node -e "console.log(require('./package.json').version)")"
tag_existed_before=$(git tag --list | grep "$package_version" | wc -l)
if [ "$tag_existed_before" == "0" ]; then
git config --global user.email "intercom-gpr-reader@intercom.com"
git config --global user.name "intercom/github-action-workflows - Auto-Tag - GitHub Action"
git tag -a "$package_version" -m "$package_version"
git push origin "$package_version"
echo "Pushed tag $package_version"
else
echo "Tag $package_version already exists, not overwriting"
fi

- name: Install dependencies
if: steps.package-version-check.outputs.is-pre-release == 'true'
run: yarn install --frozen-lockfile

- name: Publish to GPR
if: steps.package-version-check.outputs.is-pre-release == 'true'
run: rm .npmrc || true; npm publish || true
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.18.2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "intercom-openapi",
"name": "@intercom/intercom-openapi",
"version": "1.0.0",
"description": "This is the version controlled openapi spec for our public facing API's at developers.intercom.com, our external documenation site for people integrating into Intercom",
"scripts": {
Expand Down
Loading