diff --git a/.github/workflows/publish_webcomponents.yml b/.github/workflows/publish_webcomponents.yml new file mode 100644 index 0000000000..0e8e9638c2 --- /dev/null +++ b/.github/workflows/publish_webcomponents.yml @@ -0,0 +1,97 @@ +name: Publish to Dotcms Webcomponents +on: + push: + branches: + - release-* + - master +jobs: + changes: + runs-on: ubuntu-latest + outputs: + dotcms-webcomponents: ${{ steps.filter.outputs.dotcms-webcomponents }} + steps: + - name: Checkout core-web + uses: actions/checkout@v2 + with: + fetch-depth: 1 + path: 'core-web' + + - name: Get specific changed files + uses: dorny/paths-filter@v2 + id: filter + with: + base: ${{ github.ref }} + list-files: 'json' + working-directory: 'core-web' + filters: | + dotcms-webcomponents: + - 'libs/dotcms-webcomponents/**' + + - name: Changes found + if: steps.filter.outputs.dotcms-webcomponents == 'true' + run: | + echo "Found Dotcms-webcomponent files changed." + echo ${{ steps.filter.outputs.dotcms-webcomponents_files }} + + - name: No changes found + if: steps.filter.outputs.dotcms-webcomponents == 'false' + run: | + echo "No changes found in dotcms-webcomponents" + + publish: + needs: changes + if: ${{ needs.changes.outputs.dotcms-webcomponents == 'true' }} + runs-on: ubuntu-latest + steps: + - name: Checkout core-web + uses: actions/checkout@v2 + with: + fetch-depth: 1 + path: 'core-web' + - name: Configuring Node.js + uses: actions/setup-node@v2-beta + with: + node-version: '10.15.3' + - name: Installing dependencies + run: | + cd core-web + npm install + - name: 'Automated Version Bump - dotcms-webcomponents - if it is Release branch' + id: version-bump-release + if: ${{contains(github.ref, 'release-')}} + uses: 'phips28/gh-action-bump-version@master' + with: + commit-message: 'CI: bumps version to {{version}} [skip ci]' + skip-tag: 'true' + default: prerelease + preid: 'rc' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PACKAGEJSON_DIR: 'core-web/libs/dotcms-webcomponents' + - name: 'Automated Version Bump - dotcms-webcomponents - if it is Master branch' + id: version-bump-master + if: ${{contains(github.ref, 'master')}} + uses: 'phips28/gh-action-bump-version@master' + with: + commit-message: 'CI: bumps version to {{version}} [skip ci]' + skip-tag: 'true' + default: prerelease + preid: 'next' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PACKAGEJSON_DIR: 'core-web/libs/dotcms-webcomponents' + - name: Build dotcms-webcomponents with deps + run: | + cd core-web + npm run nx build dotcms-ui -- --with-deps --prod + - name: 'publish to npm' + run: | + cd core-web + npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} + cd dist/libs/dotcms-webcomponents + if [[ $(basename "${{ github.ref }}") =~ ^release-.* ]]; then + npm publish --tag rc + fi + if [[ $(basename "${{ github.ref }}") =~ ^master ]]; then + npm publish --tag next + fi diff --git a/libs/dotcms-webcomponents/package.json b/libs/dotcms-webcomponents/package.json new file mode 100644 index 0000000000..4df56f94ce --- /dev/null +++ b/libs/dotcms-webcomponents/package.json @@ -0,0 +1,4 @@ +{ + "name": "dotcms-webcomponents", + "version": "0.0.24" +}