diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 0754b2a7..4dd8d746 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -4,10 +4,15 @@ inputs: node-version: description: 'The Node.js version to use. The default one is going to be the defined on the .nvmrc file.' required: false + full-checkout: + description: 'Whether to do a full checkout or not. A full checkout will fetch all commits from the repository.' + required: false + default: true runs: using: composite steps: - name: Checkout all commits + if: ${{ inputs.full-checkout == 'true' }} uses: actions/checkout@v4 with: fetch-depth: 0 @@ -24,6 +29,12 @@ runs: echo "NODE_VERSION=${{ inputs.node-version }}" >> $GITHUB_ENV fi + - name: git config + shell: bash + run: | + git config user.name "ngx-deploy-npm bot" + git config user.email "-" + - name: Use Node.js uses: actions/setup-node@v4 with: diff --git a/.github/workflows/pr.yml b/.github/workflows/ci.yml similarity index 78% rename from .github/workflows/pr.yml rename to .github/workflows/ci.yml index 1357fe0c..0dadfaa1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ -name: PR's -on: - pull_request: - types: [opened, synchronize, reopened] +name: CI +# on: +# pull_request: +# types: [opened, synchronize, reopened] env: PR_NUMBER: ${{ github.event.pull_request.number }} @@ -13,16 +13,6 @@ jobs: pr-e2e-test: uses: ./.github/workflows/e2e-test.yml - check-commit-lint: - name: Check commit message follows guidelines - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup - - - name: Execute commitlint - run: npx commitlint --from=origin/${{ github.base_ref }} - check-file-format: name: Check files changes follow guidelines runs-on: ubuntu-latest diff --git a/.github/workflows/enforce-semantic-commits.yml b/.github/workflows/enforce-semantic-commits.yml new file mode 100644 index 00000000..debba0f2 --- /dev/null +++ b/.github/workflows/enforce-semantic-commits.yml @@ -0,0 +1,74 @@ +#? should we comment in the PR? +name: Enforce Semantic Commits + +on: + pull_request: + types: [opened, edited, synchronize] #? reopened + +jobs: + check-semantic-commits: + name: Check Semantic Commits + runs-on: ubuntu-latest + + steps: + - name: git clone + uses: actions/checkout@v4 + - name: Setup + uses: ./.github/actions/setup + + - name: Check commit messages + run: npx commitlint --from=origin/${{ github.base_ref }} + + # Based on PR name + generate-commit-message: + name: Generate Commit Message + runs-on: ubuntu-latest + outputs: + commit_message: ${{ steps.generate-message.outputs.commit_message }} + steps: + - name: git clone + uses: actions/checkout@v4 + + - name: Generate Title + id: generate-message + run: | + COMMIT_MESSAGE='${{ github.event.pull_request.title }}' + echo "Commit Message": '$COMMIT_MESSAGE' + echo "commit_message=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT + echo "$COMMIT_MESSAGE" + + validate-commit-message: + needs: [generate-commit-message] + name: Validate Commit Message + runs-on: ubuntu-latest + steps: + - name: git clone + uses: actions/checkout@v4 + - name: Setup + uses: ./.github/actions/setup + with: + full-checkout: false + + - name: Validate Title + run: echo "${{needs.generate-commit-message.outputs.commit_message}}" | npx commitlint + + generate-changelog: + needs: [generate-commit-message, validate-commit-message] + name: Generate Changelog + runs-on: ubuntu-latest + steps: + - name: git clone + uses: actions/checkout@v4 + - name: Setup + uses: ./.github/actions/setup + + - name: Generate tmp branch + run: git checkout -b changelog + + - name: Squash commits + run: | + git reset --soft $(git merge-base origin/${{ github.base_ref }} HEAD) + git commit -m "$COMMIT_MESSAGE" + git log -n 3 + env: + COMMIT_MESSAGE: ${{needs.generate-commit-message.outputs.commit_message}} diff --git a/.github/workflows/publishment.yml b/.github/workflows/publishment.yml index b83feca0..2fe1f3cf 100644 --- a/.github/workflows/publishment.yml +++ b/.github/workflows/publishment.yml @@ -53,12 +53,6 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/setup - - name: git config - shell: bash - run: | - git config user.name "Github Actions" - git config user.email "-" - - uses: ./.github/actions/download-build - name: Check npm credentials diff --git a/packages/ngx-deploy-npm/project.json b/packages/ngx-deploy-npm/project.json index c127c28c..c08f569e 100644 --- a/packages/ngx-deploy-npm/project.json +++ b/packages/ngx-deploy-npm/project.json @@ -65,7 +65,7 @@ ] } }, - "deploy": { + "publish": { "executor": "./dist/packages/ngx-deploy-npm:deploy", "options": { "distFolderPath": "dist/packages/ngx-deploy-npm", @@ -73,7 +73,7 @@ }, "dependsOn": ["build"] }, - "deploy:without-build": { + "publish:without-build": { "executor": "./dist/packages/ngx-deploy-npm:deploy", "options": { "distFolderPath": "dist/packages/ngx-deploy-npm", @@ -90,7 +90,6 @@ "version": { "executor": "@jscutlery/semver:version", "options": { - "postTargets": ["build", "deploy"], "versionTagPrefix": "v" } }