remove comments #4
This file contains hidden or 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: 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 "[email protected]" | |
| 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 }} |