diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..1f9dd90 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,45 @@ +--- +name: Release + +on: # yamllint disable rule:truthy + workflow_dispatch: + push: + branches: [master, main] + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + release: + name: Release with semantic-release + runs-on: ubuntu-latest + steps: + - name: Checkout code (SSH) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '24' + cache: 'npm' + cache-dependency-path: '**/.github/workflows/*.yaml' + + - name: Run semantic-release + env: + GIT_AUTHOR_NAME: "github-actions[bot]" + GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com" + GIT_COMMITTER_NAME: "github-actions[bot]" + GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com" + GITHUB_TOKEN: ${{ github.token }} + run: | + npx -y \ + -p semantic-release@25.0.1 \ + -p @semantic-release/git@10.0.1 \ + -p conventional-changelog-conventionalcommits@9.1.0 \ + -p semantic-release-replace-plugin@1.2.7 \ + semantic-release diff --git a/.releaserc.yaml b/.releaserc.yaml new file mode 100644 index 0000000..c9ead6c --- /dev/null +++ b/.releaserc.yaml @@ -0,0 +1,26 @@ +--- +branches: + - main + +# Use bare tag names, e.g., 1.2.3 +tagFormat: ${version} + +plugins: + - - '@semantic-release/commit-analyzer' + - preset: conventionalcommits + - - '@semantic-release/release-notes-generator' + - preset: conventionalcommits + - - 'semantic-release-replace-plugin' + - replacements: + - files: ['version.yaml'] + from: 'sprinkler_config_version\s*:.*' + to: "sprinkler_config_version: '${nextRelease.version}'" + - - '@semantic-release/git' + - assets: + - version.yaml + message: 'chore(release): ${nextRelease.version} [skip ci]' + - - '@semantic-release/github' + # yamllint disable rule:line-length + - successComment: | + :tada: This ${issue.pull_request ? 'pull request' : 'issue'} has been included in version [${nextRelease.version}](${releases[0]?.url}) + # yamllint enable rule:line-length diff --git a/main.yaml b/main.yaml index 5b4cb61..1a1c4df 100644 --- a/main.yaml +++ b/main.yaml @@ -3,6 +3,7 @@ --- packages: substitutions: !include substitutions.yaml + version: !include version.yaml outputs: !include outputs.yaml controllers: !include controllers.yaml status_sensors: !include status_sensors.yaml diff --git a/version.yaml b/version.yaml index 5640997..7074146 100644 --- a/version.yaml +++ b/version.yaml @@ -1,4 +1,5 @@ - - --- - substitutions: - sprinkler_config_version: '2.0.0' +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2025 Ilia Sotnikov +--- +substitutions: + sprinkler_config_version: '0.0.0'