diff --git a/.github/workflows/build-publish-docker.yml b/.github/workflows/build-publish-docker.yml index 241d4ad..5465e22 100644 --- a/.github/workflows/build-publish-docker.yml +++ b/.github/workflows/build-publish-docker.yml @@ -15,12 +15,27 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Semantic Release - uses: semantic-release/git-semantic-release-action@v3 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 'lts/*' + + - name: Semantic Release Version + id: semantic-version env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - version_variable: 'TAG_NAME' + # because of using none default (conventionalcommits) `preset` for `semantic-release`, we should add dependency `conventional-changelog-conventionalcommits` + # using dry-run here for preventing publish release note and just calculate version + run: npx -p conventional-changelog-conventionalcommits -p @semantic-release/git -p @semantic-release/changelog -p @semantic-release/exec semantic-release --dry-run + + - name: Semantic Release Versions Outputs + run: | + echo ${{ steps.semantic-version.outputs.semantic_nextRelease_version }} + echo ${{ steps.semantic-version.outputs.semantic_nextRelease_channel }} + echo ${{ steps.semantic-version.outputs.semantic_nextRelease_gitTag }} + echo ${{ steps.semantic-version.outputs.semantic_lastRelease_version }} + echo ${{ steps.semantic-version.outputs.semantic_lastRelease_channel }} + echo ${{ steps.semantic-version.outputs.semantic_lastRelease_gitTag }} - name: Login to DockerHub uses: docker/login-action@v2 diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml new file mode 100644 index 0000000..ef2c355 --- /dev/null +++ b/.github/workflows/conventional-commits.yml @@ -0,0 +1,41 @@ +name: Conventional Commits + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + - edited + - ready_for_review + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + conventional-commits: + runs-on: ubuntu-latest + steps: + - name: check-pull-request-conventional-commits + uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: fuxingloh/multi-labeler@v1 + name: conventional-commits-pull-request-labeler + if: success() + with: + github-token: ${{secrets.GITHUB_TOKEN}} # optional, default to '${{ github.token }}' + config-path: .github/multi-labeler.yml # optional, default to '.github/labeler.yml' + + # https://docs.github.com/en/actions/using-workflows/about-workflows#creating-dependent-jobs + # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow + - name: check-conventional-commits-labels + uses: docker://agilepathway/pull-request-label-checker:latest + if: success() + with: + any_of : feature,bug,enhancement,deprecated,security,documentation,build,ci/cd,chore,performance,formatting,dependencies + repo_token: ${{ secrets.GITHUB_TOKEN }}