diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9ef754e78..634bb9f8a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -4,7 +4,6 @@ on: pull_request: branches: - main - - alpha jobs: build_and_test: diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ffc0579ad..a2f98c4cc 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -4,7 +4,16 @@ on: push: branches: - main - - alpha + workflow_dispatch: + inputs: + prerelease: + description: 'Create a pre-release version' + required: false + default: 'false' + type: choice + options: + - 'false' + - 'true' jobs: release: @@ -27,6 +36,20 @@ jobs: - name: Unit tests run: npm run test:ci - - run: npm run release + - name: Check manual release conditions + if: github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease == 'false' && github.ref != 'refs/heads/main' + run: | + echo "::error::Cannot run standard release from non-main branch. Use prerelease=true instead." + exit 1 + + - name: Pre-release + if: github.event.inputs.prerelease == 'true' + run: npm run release + env: + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + + - name: Automatic release + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + run: npm run release env: GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} diff --git a/release.config.js b/release.config.js index 9fd53b0b1..60c86fb8e 100644 --- a/release.config.js +++ b/release.config.js @@ -1,6 +1,10 @@ const package = 'systemlink-grafana-plugins'; module.exports = { + branches: [ + 'main', + { name: '*', prerelease: 'pre' } + ], plugins: [ ["@semantic-release/commit-analyzer", { preset: "conventionalcommits"