chore(deps): bump @opentelemetry/instrumentation from 0.53.0 to 0.54.… #112
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: Release | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "libs/**" | |
- package.json | |
- package-lock.json | |
- ".github/workflows/**" | |
workflow_dispatch: | |
jobs: | |
tagging: | |
runs-on: ubuntu-latest | |
if: ${{ contains(github.ref, 'main') }} | |
name: GitHub Tagging | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v4 | |
- name: Set application version | |
run: | | |
echo "PACKAGE=v$(echo `cat package.json | jq -r .version`)" >> $GITHUB_ENV | |
- name: Create Tag | |
uses: actions/github-script@v7 | |
if: ${{ env.PACKAGE }} | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
let tagExists = []; | |
try { | |
await github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/${{ env.PACKAGE }}", | |
sha: context.sha | |
}); | |
} catch (e) { | |
console.log("Tag already exists: " + e) | |
tagExists.push(e); | |
} | |
if (tagExists.length > 0) { | |
await github.rest.git.updateRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "tags/${{ env.PACKAGE }}", | |
sha: context.sha | |
}); | |
} | |
release: | |
runs-on: ubuntu-latest | |
if: ${{ contains(github.ref, 'main') }} | |
name: GitHub Release | |
needs: [tagging] | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v4 | |
- name: Set application version | |
run: | | |
echo "PACKAGE=v$(echo `cat package.json | jq -r .version`)" >> $GITHUB_ENV | |
- name: Create Release | |
uses: actions/github-script@v7 | |
id: release | |
if: ${{ env.PACKAGE }} | |
with: | |
github-token: ${{ github.token }} | |
result-encoding: string | |
script: | | |
const { repo: { owner, repo }, sha } = context; | |
const tag = process.env.PACKAGE; | |
let release_id = 0; | |
try { | |
const release = await github.rest.repos.createRelease({ | |
owner, repo, | |
tag_name: tag, | |
title: tag, | |
name: tag, | |
draft: false, | |
make_latest: "true", | |
target_commitish: sha | |
}); | |
release_id = release.data.id; | |
} catch (e) { | |
let latest; | |
if (e.status == 422) { // Release alredy exists | |
latest = await github.rest.repos.getLatestRelease({ | |
owner, repo | |
}); | |
} | |
release_id = latest.data.id; | |
} | |
return release_id | |
npm: | |
runs-on: ubuntu-latest | |
if: ${{ contains(github.ref, 'main') }} | |
name: NPM Release | |
needs: [tagging, release] | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v4 | |
- name: NPM Release | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
npm set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_TOKEN }} | |
npm publish |