diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 32c36ee..89a4683 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @StuartApp/sysadmins +@StuartApp/sre diff --git a/.github/common-dependencies/action.yaml b/.github/common-dependencies/action.yaml new file mode 100644 index 0000000..9f770ea --- /dev/null +++ b/.github/common-dependencies/action.yaml @@ -0,0 +1,27 @@ +--- +name: common-dependencies +description: Set up common workflow dependencies +inputs: + NODEJS_VERSION: + description: Required Workflow Node JS version + required: false + PYTHON_VERSION: + description: Required Workflow Python version + required: false + GO_VERSION: + description: Required Workflow GO version + required: false +runs: + using: composite + steps: + - if: ${{ inputs.NODEJS_VERSION != '' }} + name: Setup NodeJS ${{ inputs.NODEJS_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ inputs.NODEJS_VERSION }} + + - if: ${{ inputs.PYTHON_VERSION != '' }} + name: Setup Python ${{ inputs.PYTHON_VERSION }} + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.PYTHON_VERSION }} \ No newline at end of file diff --git a/.github/workflows/on-pr-title.yaml b/.github/workflows/on-pr-title.yaml new file mode 100644 index 0000000..6da32fe --- /dev/null +++ b/.github/workflows/on-pr-title.yaml @@ -0,0 +1,38 @@ +--- +name: Validate PR title + +on: # yamllint disable-line rule:truthy + pull_request: + types: + - opened + - edited + - reopened + - synchronize + +jobs: + pr-title: + name: Validate PR title + runs-on: self-hosted + steps: + - name: Retrieve GitHub event payload + run: echo $GH_EVENT_PAYLOAD + env: + GH_EVENT_PAYLOAD: ${{ toJSON(github.event) }} + - uses: amannn/action-semantic-pull-request@v5.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + types: | + fix + feat + docs + ci + chore + requireScope: false + subjectPattern: ^([A-Z]{2,}[0-9]{0,1}-[0-9]+).*$ + subjectPatternError: | + The subject "{subject}" found in the pull request title "{title}" + didn't match the configured pattern. Please ensure that the subject + starts with its associated Jira issue id. + wip: true + validateSingleCommit: false \ No newline at end of file diff --git a/.github/workflows/on-pr.yaml b/.github/workflows/on-pr.yaml new file mode 100644 index 0000000..ac987d5 --- /dev/null +++ b/.github/workflows/on-pr.yaml @@ -0,0 +1,28 @@ +name: Check Pull Request + +on: + pull_request: + branches: + - master +jobs: + release-test: + name: release-test + runs-on: + - self-hosted + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js with GitHub Package Registry + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v4 + with: + branch: master + extra_plugins: | + @semantic-release/git + @semantic-release/changelog + dry_run: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/on-push.yaml b/.github/workflows/on-push.yaml new file mode 100644 index 0000000..d311ada --- /dev/null +++ b/.github/workflows/on-push.yaml @@ -0,0 +1,45 @@ +--- +name: Semantic Release + +on: # yamllint disable-line rule:truthy + push: + branches: + - master +env: + NODEJS_VERSION: 16 + +jobs: + semantic-release: + name: Create and Publish Semantic Release + runs-on: self-hosted + outputs: + publish: ${{ steps.semantic-release.outputs.new_release_published }} + version: ${{ steps.semantic-release.outputs.new_release_version }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: ./.github/common-dependencies + with: + NODEJS_VERSION: ${{ env.NODEJS_VERSION }} + + - name: Semantic Release + id: semantic-release + uses: cycjimmy/semantic-release-action@v3 + with: + semantic_version: 19.0.5 + extra_plugins: | + @semantic-release/git@10.0.1 + @semantic-release/changelog@6.0.1 + conventional-changelog-conventionalcommits@4.6.3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GIT_COMMITTER_NAME: ${{ vars.GH_BOT_NAME }} + GIT_AUTHOR_NAME: ${{ vars.GH_BOT_NAME }} + GIT_COMMITTER_EMAIL: ${{ vars.GH_BOT_EMAIL }} + GIT_AUTHOR_EMAIL: ${{ vars.GH_BOT_EMAIL }} + + - name: Print new version + run: echo ${{ steps.semantic-release.outputs.new_release_version }} diff --git a/.gitignore b/.gitignore index 279991d..33bf0bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.egg-info/ build/ dist/ +.vscode/ .venv/ diff --git a/.releaserc.yaml b/.releaserc.yaml new file mode 100644 index 0000000..04416e1 --- /dev/null +++ b/.releaserc.yaml @@ -0,0 +1,25 @@ +--- +branches: + - master +ci: false +plugins: + - - "@semantic-release/commit-analyzer" + - preset: conventionalcommits + - - "@semantic-release/release-notes-generator" + - preset: conventionalcommits + - - "@semantic-release/github" + - successComment: >- + 'This PR is included in version ${nextRelease.version} :rocket:' + labels: false + releasedLabels: false + - - "@semantic-release/changelog" + - changelogFile: CHANGELOG.md + changelogTitle: |- + # [CHANGELOG](https://keepachangelog.com/en/1.0.0/) + - - "@semantic-release/git" + - assets: + - CHANGELOG.md + message: |- + chore(release): version ${nextRelease.version} [skip ci] + + ${nextRelease.notes} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29