diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4cdc1ad --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,23 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "nuget" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "monthly" + groups: + all: + patterns: + - "*" + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "monthly" + groups: + all: + patterns: + - "*" \ No newline at end of file diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..72e93a6 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,65 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: '🛠 Breaking Changes' + labels: + - 'breaking-change' + - 'major' + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + labels: + - 'chore' + - 'dependencies' + - 'security' + - title: '🏗️ GitHub actions' + labels: + - 'ci' + - 'github-actions' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +commitish: 'main' +exclude-labels: + - "ignore-for-release" +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +autolabeler: + - label: 'chore' + branch: + - '/docs{0,1}\/.+/' + title: + - "/chore/i" + - "/docs/i" + - label: 'github-actions' + title: + - "/github actions/i" + - "/ci/i" + - label: 'bug' + branch: + - '/fix\/.+/' + title: + - "/bug/i" + - "/fix/i" + - label: 'feature' + title: + - "/feat/i" +template: | + ## Changes + + $CHANGES \ No newline at end of file diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml new file mode 100644 index 0000000..e4da4ea --- /dev/null +++ b/.github/workflows/publish-nuget.yml @@ -0,0 +1,53 @@ +name: Publish C# package to the Github NuGet registry + +on: + release: + types: [published] + workflow_dispatch: + inputs: + version: + description: 'Version to publish' + required: true + +env: + # tag names are formatted like `v1.0.0`, nuget needs it without a `v` + PACKAGE_VERSION_PREFIXED: ${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.version }} + +jobs: + test: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Install dependencies + run: dotnet restore + - name: Test + run: dotnet test --no-build + + publish: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + needs: + - test + steps: + - uses: actions/checkout@v4 + - name: Format nuget version + run: | + echo "PACKAGE_VERSION=${PACKAGE_VERSION_PREFIXED#v}" | tee -a $GITHUB_ENV + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Install dependencies + run: dotnet restore + - name: Build + run: dotnet build --configuration Release + working-directory: Q42.Google.Cloud.Compute.Metadata.V1 + - name: Publish to github nuget registry + run: dotnet nuget push bin/Release/*.nupkg --api-key "${{ secrets.NUGET_KEY }}" --source "https://api.nuget.org/v3/index.json" + working-directory: Q42.Google.Cloud.Compute.Metadata.V1 diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..2194c93 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,42 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - main + # pull_request event is required only for autolabeler + pull_request: + # Only following types are handled by the action, but one can default to all as well + types: [opened, reopened, synchronize] + # pull_request_target event is required for autolabeler to support PRs from forks + # pull_request_target: + # types: [opened, reopened, synchronize] + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: write + runs-on: ubuntu-latest + steps: + # (Optional) GitHub Enterprise requires GHE_HOST variable set + #- name: Set GHE_HOST + # run: | + # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV + + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + name: Release Drafter + id: drafter + with: + disable-autolabeler: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/verify-pr b/.github/workflows/verify-pr new file mode 100644 index 0000000..4a30ace --- /dev/null +++ b/.github/workflows/verify-pr @@ -0,0 +1,27 @@ +name: Publish C# package to the Github NuGet registry + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: 📥 Restore dependencies + run: dotnet restore --verbosity normal + - name: 🔨 Build + run: dotnet build --no-restore --verbosity normal + - name: 📋 Test + run: dotnet test --no-restore --verbosity normal diff --git a/Q42.Google.Cloud.Compute.Metadata.V1/Q42.Google.Cloud.Compute.Metadata.V1.csproj b/Q42.Google.Cloud.Compute.Metadata.V1/Q42.Google.Cloud.Compute.Metadata.V1.csproj index 3a63532..bf329ee 100644 --- a/Q42.Google.Cloud.Compute.Metadata.V1/Q42.Google.Cloud.Compute.Metadata.V1.csproj +++ b/Q42.Google.Cloud.Compute.Metadata.V1/Q42.Google.Cloud.Compute.Metadata.V1.csproj @@ -4,6 +4,10 @@ net8.0 enable enable + Q42.Google.Cloud.Compute.Metadata.V1 + $(PACKAGE_VERSION) + Q42 + true