diff --git a/.github/workflows/on-merge-to-main.yml b/.github/workflows/on-merge-to-main.yml new file mode 100644 index 0000000000..4ae527d019 --- /dev/null +++ b/.github/workflows/on-merge-to-main.yml @@ -0,0 +1,93 @@ +name: on-merge-to-main +on: + push: + branches: + - main + workflow_dispatch: {} +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + token: ${{ secrets.GH_PUBLISH_TOKEN }} + fetch-depth: 0 + ######################### + # Release new version + ######################### + - name: "Use NodeJS 14" + uses: actions/setup-node@v2 + with: + node-version: '14' + - name: "Setup npm" + run: | + npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" + - name: Install packages + run: | + npm ci + npm run lerna-ci + - name: Run lint + run: npm run lerna-lint + - name: Run tests + run: npm run lerna-test + - name: "Version and publish" + env: + GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }} + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY + + # For merge to main we + ## don't create github release, + ## don't update changelog (--no-changelog) + ## bump version as a pre-release (--conventional-prerelease) + ## add a custom preid (--preid dev): 0.2.0-dev.1 -> 0.2.0-dev.2 + npx lerna version --conventional-commits --conventional-prerelease --preid dev --force-publish=* --yes --no-changelog + git push --delete origin $(git describe --abbrev=0) + - name: update_release_draft: + uses: release-drafter/release-drafter@v5.15.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ######################### + # Generate documentation + ######################### + - name: Set up Python + uses: actions/setup-python@v2.3.1 + with: + python-version: '3.8' + - name: Install doc generation dependencies + run: | + pip install --upgrade pip + pip install -r docs/requirements.txt + - name: Setup doc deploy + run: | + git config --global user.name Docs deploy + git config --global user.email docs@dummy.bot.com + - name: Build mkdocs site in "gh-pages" branch and push + run: | + rm -rf site + VERSION="dev" + echo "Publishing doc for version: $VERSION" + mkdocs build + mike deploy --push "$VERSION" + - name: Build API docs + run: | + rm -rf api + npm run docs-generateApiDoc + - name: Release API docs to the released version + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./api + keep_files: true + destination_dir: dev/api + - name: Release API docs to the "latest" version + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./api + keep_files: true + destination_dir: latest/api diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release-prod.yml similarity index 90% rename from .github/workflows/on-release.yml rename to .github/workflows/on-release-prod.yml index 7d5604fd48..d47b1ba684 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release-prod.yml @@ -1,8 +1,5 @@ name: release on: - push: - branches: - - main workflow_dispatch: {} jobs: publish: @@ -44,12 +41,7 @@ jobs: git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY - - if [ ${{ github.base_ref }} = main ]; then - npx lerna version --conventional-commits --create-release github --force-publish=* --yes - else - npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes - fi + npx lerna version --conventional-commits --conventional-graduate --force-publish=* --yes npx lerna publish from-git --no-verify-access --yes ######################### # Generate documentation diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 67f7eb268e..0000000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Release Drafter - -on: - push: - branches: - - main - -jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - - uses: release-drafter/release-drafter@v5.15.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}