diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index a0a67fb..c8fa0b7 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -8,7 +8,9 @@ on: branches: - master workflow_dispatch: - + release: + types: + - published jobs: build: @@ -38,7 +40,7 @@ jobs: yarn env: NODE_OPTIONS: "--max_old_space_size=4096" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Test shell: bash @@ -47,7 +49,7 @@ jobs: env: NODE_OPTIONS: "--max_old_space_size=4096" - publish: + publish-next: needs: build if: github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository == 'eclipse-cdt-cloud/timeline-chart' @@ -75,7 +77,7 @@ jobs: yarn env: NODE_OPTIONS: --max_old_space_size=4096 - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish uses: nick-invision/retry@v2 @@ -87,3 +89,39 @@ jobs: command: yarn publish:next env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # The variable name comes from here: https://github.com/actions/setup-node/blob/70b9252472eee7495c93bb1588261539c3c2b98d/src/authutil.ts#L48 + + publish-latest: + needs: build + if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'eclipse-cdt-cloud/timeline-chart' + runs-on: ubuntu-latest + strategy: + matrix: + node: [16] + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + persist-credentials: false + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + registry-url: 'https://registry.npmjs.org' + - name: Pre-Publish + shell: bash + run: | + yarn + env: + NODE_OPTIONS: --max_old_space_size=4096 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish + uses: nick-invision/retry@v2 + with: + timeout_minutes: 5 + retry_wait_seconds: 60 + max_attempts: 3 + retry_on: error + command: yarn publish:latest:ci + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # The variable name comes from here: https://github.com/actions/setup-node/blob/70b9252472eee7495c93bb1588261539c3c2b98d/src/authutil.ts#L48 + \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..29572c0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Create or prepare GitHub release + +on: + push: + branches: + - master + paths: + - 'RELEASE' + pull_request: + types: [opened, synchronize] + branches: + - master + paths: + - 'RELEASE' + +jobs: + gh-release: + name: GitHub release + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: pipe-cd/actions-gh-release@v2.6.0 + with: + release_file: 'RELEASE' + # Actions that run using the auto-generated GitHub token are + # not allowed to trigger a new workflow run. In this case we want + # the tag created by actions-gh-release to re-trigger the main workflow + # and result in publishing the package to npm. + # The following scopes are required when creating the committer token: + # - repo:status, repo_deployment, public_repo, read:org + # See here for more details: + # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow + token: ${{ secrets.GH_COMMITTER_TOKEN }} + \ No newline at end of file diff --git a/RELEASE b/RELEASE new file mode 100644 index 0000000..84fcd30 --- /dev/null +++ b/RELEASE @@ -0,0 +1,8 @@ +tag: v0.0.0 + +commitInclude: + parentOfMergeCommit: true + +releaseNoteGenerator: + showAbbrevHash: true + showCommitter: false \ No newline at end of file diff --git a/package.json b/package.json index 714bf96..7206145 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,4 @@ { - "version": "0.1.0", "private": true, "license": "MIT", "scripts": { @@ -8,25 +7,15 @@ "watch": "lerna run watch", "start": "lerna run start", "test": "lerna run test --", - "publish:latest": "lerna publish --registry=https://registry.npmjs.org/ --exact --no-git-tag-version --no-push", + "publish:latest:ci": "lerna publish from-git --registry=https://registry.npmjs.org/ --exact --no-push --yes", + "publish:latest:manual": "lerna publish --registry=https://registry.npmjs.org/ --exact --no-git-tag-version --no-push --yes", "publish:next": "lerna publish --registry=https://registry.npmjs.org/ --exact --canary minor --preid=next.$(date -u '+%Y%m%d%H%M%S').$(git rev-parse --short HEAD) --dist-tag=next --no-git-tag-version --no-push --yes", + "version:major": "lerna version major --exact --no-push --git-tag-command /usr/bin/true --yes -m \"Release %s (Major)\"", + "version:minor": "lerna version minor --exact --no-push --git-tag-command /usr/bin/true --yes -m \"Release %s (Minor)\"", + "version:patch": "lerna version patch --exact --no-push --git-tag-command /usr/bin/true --yes -m \"Release %s (Patch)\"", "license:check": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json", "license:check:review": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json --review" }, - "keywords": [ - "gantt", - "timeline", - "tracing", - "trace" - ], - "repository": { - "type": "git", - "url": "https://github.com/theia-ide/timeline-chart" - }, - "bugs": { - "url": "https://github.com/theia-ide/timeline-chart/issues" - }, - "homepage": "https://github.com/theia-ide/timeline-chart", "devDependencies": { "@eclipse-dash/nodejs-wrapper": "^0.0.1", "lerna": "^7.0.0",