From 8ae8a081ad65e1b7b69a68810317f23fe2d12b51 Mon Sep 17 00:00:00 2001 From: Pedro Domingues Date: Mon, 12 Aug 2024 10:50:37 -0300 Subject: [PATCH] =?UTF-8?q?ci(lts):=20realiza=20a=20publica=C3=A7=C3=A3o?= =?UTF-8?q?=20de=20vers=C3=B5es=20LTS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/publish_po_angular_ci-17.yml | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 .github/workflows/publish_po_angular_ci-17.yml diff --git a/.github/workflows/publish_po_angular_ci-17.yml b/.github/workflows/publish_po_angular_ci-17.yml new file mode 100644 index 0000000000..fa7316d5e7 --- /dev/null +++ b/.github/workflows/publish_po_angular_ci-17.yml @@ -0,0 +1,163 @@ +name: PO-UI Publish Angular@17 + +# URL para os pacotes po-ui no npm +env: + SCHEMATICS_NPM_PATH: po-ui/ng-schematics + STORAGE_NPM_PATH: po-ui/ng-storage + SYNC_NPM_PATH: po-ui/ng-sync + COMPONENTS_NPM_PATH: po-ui/ng-components + TEMPLATES_NPM_PATH: po-ui/ng-templates + CODE_EDITOR_NPM_PATH: po-ui/ng-code-editor + WORKING_DIR: /home/runner/work/po-angular/po-angular/po-angular + +on: + workflow_dispatch: + +jobs: + build-and-publish: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/17.x.x' + steps: + - uses: actions/setup-node@v3 + with: + node-version: '18.x' + registry-url: 'https://registry.npmjs.org' + + - name: Check out po-angular + uses: actions/checkout@v4 + with: + path: po-angular + + - name: Check out style + uses: actions/checkout@v4 + with: + repository: po-ui/po-style + path: po-style + + - name: Check out lint + uses: actions/checkout@v4 + with: + repository: po-ui/po-tslint + path: po-tslint + + - name: Install and Build + run: npm install && npm run build + working-directory: ${{env.WORKING_DIR}} + + # Pega as versões publicadas no NPM e salva no arquivo versions.json + - name: Obter todas as versões publicadas + run: npm show @${{ env.COMPONENTS_NPM_PATH }} versions --json > versions.json + + # Pega a versão no package.json + - name: Get package.json version. + id: package-version + uses: martinbeentjes/npm-get-version-action@main + with: + path: po-angular + + # Verifica se a versão a ser publicada já existe no NPM + - name: Verificar se a versão existe + id: version + run: | + VERSION_TO_CHECK=${{ steps.package-version.outputs.current-version }} + if jq -e --arg version "$VERSION_TO_CHECK" '.[] | select(. == $version)' versions.json; then + echo "publish=no" >> "$GITHUB_OUTPUT" + else + echo "publish=yes" >> "$GITHUB_OUTPUT" + fi + + # PUBLISH NG-SCHEMATICS + - name: ng-schematics - publish + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-schematics --tag "v17-lts" --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-schematics - add "v17-lts" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.SCHEMATICS_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "v17-lts" + working-directory: ${{env.WORKING_DIR}} + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + # PUBLISH NG-STORAGE + - name: ng-storage - publish + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-storage --tag "v17-lts" --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-storage - add "v17-lts" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.STORAGE_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "v17-lts" + working-directory: ${{env.WORKING_DIR}} + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + # PUBLISH NG-SYNC + - name: ng-sync - publish + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-sync --tag "v17-lts" --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-sync - add "v17-lts" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.SYNC_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "v17-lts" + working-directory: ${{env.WORKING_DIR}} + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + # PUBLISH NG-COMPONENTS + - name: ng-components - publish + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-components --tag "v17-lts" --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-components - add "v17-lts" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.COMPONENTS_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "v17-lts" + working-directory: ${{env.WORKING_DIR}} + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + # PUBLISH NG-TEMPLATES + - name: ng-templates - publish + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-templates --tag "v17-lts" --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-templates - add "v17-lts" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.TEMPLATES_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "v17-lts" + working-directory: ${{env.WORKING_DIR}} + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + # PUBLISH NG-CODE-EDITOR + - name: ng-code-editor - publish + if: contains(steps.version.outputs.publish, 'yes') + run: npm publish ${{env.WORKING_DIR}}/dist/ng-code-editor --tag "v17-lts" --ignore-scripts + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ng-code-editor - add "v17-lts" tag + if: contains(steps.version.outputs.publish, 'no') + run: npm dist-tags add @${{ env.CODE_EDITOR_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "v17-lts" + working-directory: ${{env.WORKING_DIR}} + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}