-
Notifications
You must be signed in to change notification settings - Fork 2
Automation #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automation #1
Changes from 4 commits
72753c3
ba87116
d5ebe3e
8950b86
b29dbd8
ccf33c9
82a250e
463dc49
2d74bcc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| Blake.Types: | ||
| - changed-files: | ||
| - any-glob-to-any-file: 'src/Blake.Types/**' | ||
|
|
||
| Blake.MarkdownParser: | ||
| - changed-files: | ||
| - any-glob-to-any-file: 'src/Blake.MarkdownParser/**' | ||
|
|
||
| Blake.BuildTools: | ||
| - changed-files: | ||
| - any-glob-to-any-file: 'src/Blake.BuildTools/**' | ||
|
|
||
| Blake.CLI: | ||
| - changed-files: | ||
| - any-glob-to-any-file: 'src/Blake.CLI/**' | ||
|
|
||
| dependencies: | ||
| - changed-files: | ||
| - any-glob-to-any-file: '**/*.csproj' | ||
| - any-glob-to-any-file: '**/Directory.Packages.props' | ||
| - any-glob-to-any-file: '**/packages.lock.json' | ||
|
|
||
| enhancement: | ||
| - changed-files: | ||
| - any-glob-to-any-file: 'src/**' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| ## Summary | ||
|
|
||
| <!-- Describe the change --> | ||
|
|
||
| --- | ||
|
|
||
| 🧷 This PR will be released as a **preview** by default. | ||
|
|
||
| To trigger a **stable release**: | ||
|
|
||
| - Remove the `preview` label | ||
| - Add the `release` label | ||
| - Optionally add `Semver-Minor` or `Semver-Major` to control version bump | ||
|
|
||
| 🏷️ Add labels to control release notes: | ||
|
|
||
| - `enhancement`, `bug`, `breaking-change`, `dependencies` | ||
| - Or use `ignore-for-release` to suppress it from notes |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| changelog: | ||
| exclude: | ||
| labels: | ||
| - ignore-for-release | ||
| authors: | ||
| - dependabot | ||
| - github-actions | ||
|
|
||
| categories: | ||
| - title: 🛠 Breaking Changes | ||
| labels: | ||
| - breaking-change | ||
| - Semver-Major | ||
|
|
||
| - title: 🎉 Features | ||
| labels: | ||
| - enhancement | ||
| - Semver-Minor | ||
|
|
||
| - title: 🐛 Bug Fixes | ||
| labels: | ||
| - bug | ||
|
|
||
| - title: 👒 Dependency Updates | ||
| labels: | ||
| - dependencies | ||
|
|
||
| - title: 📦 Other Changes | ||
| labels: | ||
| - '*' |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,92 @@ | ||||||
| name: ci | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| branches: [main] | ||||||
| paths: | ||||||
| - 'src/**' | ||||||
| workflow_dispatch: | ||||||
|
|
||||||
| jobs: | ||||||
|
|
||||||
| generate-version: | ||||||
| runs-on: ubuntu-latest | ||||||
| permissions: | ||||||
| contents: write | ||||||
|
|
||||||
| steps: | ||||||
| - uses: actions/checkout@v4 | ||||||
|
|
||||||
| - name: Get last merged PR labels | ||||||
| id: prlabels | ||||||
| run: | | ||||||
| PR=$(gh pr list --state merged --base main --limit 1 --json number --jq '.[0].number') | ||||||
| LABELS=$(gh pr view $PR --json labels --jq '[.labels[].name]') | ||||||
| echo "PR_NUMBER=$PR" >> $GITHUB_ENV | ||||||
| echo "LABELS=$LABELS" >> $GITHUB_ENV | ||||||
|
|
||||||
| # Fail if both preview and release are set | ||||||
| if [[ "$LABELS" == *"preview"* && "$LABELS" == *"release"* ]]; then | ||||||
| echo "❌ Both 'preview' and 'release' labels present. Only one allowed." | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| # Fail if neither preview nor release is set | ||||||
| if [[ "$LABELS" != *"preview"* && "$LABELS" != *"release"* ]]; then | ||||||
| echo "❌ PR must have either 'preview' or 'release' label." | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| # Set PRERELEASE | ||||||
| if [[ "$LABELS" == *"preview"* ]]; then | ||||||
| echo "PRERELEASE=true" >> $GITHUB_ENV | ||||||
| else | ||||||
| echo "PRERELEASE=false" >> $GITHUB_ENV | ||||||
| fi | ||||||
|
|
||||||
| # Set bump type | ||||||
| if [[ "$LABELS" == *"Semver-Major"* ]]; then | ||||||
| echo "BUMP=major" >> $GITHUB_ENV | ||||||
| elif [[ "$LABELS" == *"Semver-Minor"* ]]; then | ||||||
| echo "BUMP=minor" >> $GITHUB_ENV | ||||||
| else | ||||||
| echo "BUMP=patch" >> $GITHUB_ENV | ||||||
| fi | ||||||
| env: | ||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
|
|
||||||
|
|
||||||
| - name: GitHub Tag Bump | ||||||
| id: tag_bump | ||||||
| uses: anothrNick/[email protected] | ||||||
| env: | ||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
| INITIAL_VERSION: 1.0.0 | ||||||
| DEFAULT_BUMP: ${{ env.BUMP }} | ||||||
| PRERELEASE: ${{ env.PRERELEASE }} | ||||||
| PRERELEASE_SUFFIX: 'preview' | ||||||
|
|
||||||
| outputs: | ||||||
| new_version: ${{ steps.tag_bump.outputs.new_tag }} | ||||||
|
|
||||||
| publish: | ||||||
| needs: generate-version | ||||||
| runs-on: ubuntu-latest | ||||||
| strategy: | ||||||
| matrix: | ||||||
| project: | ||||||
| - name: Blake.Types | ||||||
| path: src/Blake.Types/Blake.Types.csproj | ||||||
| - name: Blake.MarkdownParser | ||||||
| path: src/Blake.MarkdownParser/Blake.MarkdownParser.csproj | ||||||
| - name: Blake.BuildTools | ||||||
| path: src/Blake.BuildTools/Blake.BuildTools.csproj | ||||||
| - name: Blake.CLI | ||||||
| path: src/Blake.CLI/Blake.CLI.csproj | ||||||
| steps: | ||||||
| - name: Publish | ||||||
| uses: ./.github/workflows/reusable-publish.yml | ||||||
|
||||||
| uses: ./.github/workflows/reusable-publish.yml | |
| uses: ./.github/workflows/reusable-publish.yml@main |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Label PRs | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize, ready_for_review] | ||
|
|
||
| jobs: | ||
| add-default-preview-label: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Add 'preview' label | ||
| uses: actions-ecosystem/action-add-labels@v1 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| labels: preview | ||
|
|
||
| - name: Apply content-based labels from labeler.yml | ||
| uses: actions/labeler@v5 | ||
| with: | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Build and publish package | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| project_path: | ||
| description: 'Path to the .csproj file' | ||
| type: string | ||
| required: true | ||
| version: | ||
| description: 'Version to use for packaging' | ||
| type: string | ||
| required: true | ||
| nuget_key: | ||
| description: 'NuGet API key' | ||
| type: string | ||
| required: true | ||
|
|
||
| jobs: | ||
| package-and-publish-lib: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: 9.0.x | ||
|
|
||
| - name: Generate NuGet package | ||
| run: | | ||
| dotnet pack ${{ inputs.project_path }} \ | ||
| --configuration Release \ | ||
| -p:PackageVersion=${{ inputs.version }} \ | ||
| -o packages | ||
|
|
||
| - name: Publish NuGet package | ||
| run: dotnet nuget push packages/*.nupkg --api-key ${{ inputs.nuget_key }} --source https://api.nuget.org/v3/index.json |
Uh oh!
There was an error while loading. Please reload this page.