feat: made prerelease for types and sdk (#96) #169
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: Create package release | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- '*' | |
jobs: | |
prepare: | |
name: 'Check packages for release' | |
runs-on: ubuntu-latest | |
outputs: | |
output: ${{ steps.set_env.outputs.test }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@main | |
with: | |
ref: 'main' | |
- name: fetch tags | |
run: git fetch --tags | |
- name: collect integrations names | |
run: | | |
cd common/ | |
echo "PACKAGE=$(ls | jq --raw-input . | jq --slurp . | jq tostring)" >> $GITHUB_ENV | |
- name: set tag | |
run: echo "TAGS=$(git tag --points-at | jq --raw-input . | jq --slurp . | jq tostring)" >> $GITHUB_ENV | |
- id: output-tags | |
uses: actions/github-script@master | |
with: | |
script: | | |
const { PACKAGE, TAGS } = process.env; | |
console.log(PACKAGE); | |
console.log(TAGS); | |
const package = JSON.parse(JSON.parse(PACKAGE)); | |
const tags = JSON.parse(JSON.parse(TAGS)); | |
const selectedTags = tags.filter(it => package.includes(it.trim().split('/')[1]?.split('@')[0])) | |
return JSON.stringify(JSON.stringify(selectedTags)) | |
result-encoding: string | |
- name: print var | |
run: echo ${{steps.output-tags.outputs.result}} | |
- name: set | |
id: set_env | |
run: echo "::set-output name=test::${{steps.output-tags.outputs.result}}" | |
release: | |
name: 'Packages release' | |
if: needs.prepare.outputs.output != '[]' | |
runs-on: ubuntu-latest | |
needs: prepare | |
strategy: | |
matrix: | |
tag: ${{fromJSON(needs.prepare.outputs.output)}} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@main | |
with: | |
ref: 'main' | |
- name: set integration name | |
run: echo "PACKAGE_NAME=$(echo ${{ matrix.tag }} | awk -F'[/@]' '{print $3}' | sed 's/ *$//g')" >> $GITHUB_ENV | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: setup lerna | |
run: yarn setup | |
- name: print integration name | |
run: echo ${{ env.PACKAGE_NAME }} | |
- name: build | |
run: yarn build | |
# todo: publish to npm registry | |
# - name: Publish release | |
# run: yarn publish | |
# working-directory: common/${{env.PACKAGE_NAME}} | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate Release Body | |
run: npx extract-changelog-release ${{ github.workspace }}/common/${{env.PACKAGE_NAME}}/CHANGELOG.md > RELEASE_BODY.md | |
- name: Publish the Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: RELEASE_BODY.md | |
tag_name: ${{ matrix.tag }} | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |