From 975f66f2eebe9dadba04f275774d4ab83f74cf25 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 14:04:41 +0200 Subject: Adding upstream version 7.7.0+dfsg. Signed-off-by: Daniel Baumann --- .../lowlydba/sqlserver/.github/FUNDING.yml | 13 ++ .../sqlserver/.github/ISSUE_TEMPLATE/bug_report.md | 25 +++ .../.github/ISSUE_TEMPLATE/feature_request.md | 19 ++ .../sqlserver/.github/PULL_REQUEST_TEMPLATE.md | 22 +++ .../lowlydba/sqlserver/.github/codecov.yml | 14 ++ .../lowlydba/sqlserver/.github/dependabot.yml | 8 + .../lowlydba/sqlserver/.github/in-solidarity.yml | 8 + .../.github/workflows/ansible-test-windows.yml | 193 +++++++++++++++++++++ .../sqlserver/.github/workflows/ansible-test.yml | 172 ++++++++++++++++++ .../sqlserver/.github/workflows/docs-pr.yml | 88 ++++++++++ .../sqlserver/.github/workflows/docs-push.yml | 35 ++++ .../sqlserver/.github/workflows/release.yml | 79 +++++++++ 12 files changed, 676 insertions(+) create mode 100644 ansible_collections/lowlydba/sqlserver/.github/FUNDING.yml create mode 100644 ansible_collections/lowlydba/sqlserver/.github/ISSUE_TEMPLATE/bug_report.md create mode 100644 ansible_collections/lowlydba/sqlserver/.github/ISSUE_TEMPLATE/feature_request.md create mode 100644 ansible_collections/lowlydba/sqlserver/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 ansible_collections/lowlydba/sqlserver/.github/codecov.yml create mode 100644 ansible_collections/lowlydba/sqlserver/.github/dependabot.yml create mode 100644 ansible_collections/lowlydba/sqlserver/.github/in-solidarity.yml create mode 100644 ansible_collections/lowlydba/sqlserver/.github/workflows/ansible-test-windows.yml create mode 100644 ansible_collections/lowlydba/sqlserver/.github/workflows/ansible-test.yml create mode 100644 ansible_collections/lowlydba/sqlserver/.github/workflows/docs-pr.yml create mode 100644 ansible_collections/lowlydba/sqlserver/.github/workflows/docs-push.yml create mode 100644 ansible_collections/lowlydba/sqlserver/.github/workflows/release.yml (limited to 'ansible_collections/lowlydba/sqlserver/.github') diff --git a/ansible_collections/lowlydba/sqlserver/.github/FUNDING.yml b/ansible_collections/lowlydba/sqlserver/.github/FUNDING.yml new file mode 100644 index 000000000..c235de882 --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: lowlydba +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/ansible_collections/lowlydba/sqlserver/.github/ISSUE_TEMPLATE/bug_report.md b/ansible_collections/lowlydba/sqlserver/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..dd10bd42c --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,25 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[Bug]" +labels: bug +assignees: '' +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Versions(please complete the following information):** + +* OS: [e.g. iOS] +* SQL Server: [e.g. 2017, 2019] +* PowerShell: + +**Additional context** +Add any other context about the problem here. diff --git a/ansible_collections/lowlydba/sqlserver/.github/ISSUE_TEMPLATE/feature_request.md b/ansible_collections/lowlydba/sqlserver/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..64d2fc21b --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[Request]" +labels: enhancement +assignees: '' +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/ansible_collections/lowlydba/sqlserver/.github/PULL_REQUEST_TEMPLATE.md b/ansible_collections/lowlydba/sqlserver/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..c4f44d398 --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,22 @@ + + +## Description + + + +## How Has This Been Tested? + + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) - Fixes # +- [ ] New feature (non-breaking change which adds functionality) + +## Checklist: + + +- [ ] I have read/followed the [**CONTRIBUTING**](https://github.com/LowlyDBA/lowlydba.sqlserver/blob/main/CONTRIBUTING.md) document. +- [ ] I have read/followed the [PR Quick Start Guide](https://docs.ansible.com/ansible/devel/community/create_pr_quick_start.html) +- [ ] I have added tests to cover my changes or they are N/A. +- [ ] I have added a [changelog fragment](https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelogs.rst#changelog-fragment-categories) describing the changes. +- [ ] New module options/parameters include a [`version_added` property](https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html#documentation-fields). diff --git a/ansible_collections/lowlydba/sqlserver/.github/codecov.yml b/ansible_collections/lowlydba/sqlserver/.github/codecov.yml new file mode 100644 index 000000000..afdb55e74 --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/codecov.yml @@ -0,0 +1,14 @@ +fixes: + - "/ansible_collections/lowlydba/sqlserver/::" + +coverage: + status: + project: + default: + # basic + target: auto + threshold: 5% + patch: + default: + # basic + target: 90% diff --git a/ansible_collections/lowlydba/sqlserver/.github/dependabot.yml b/ansible_collections/lowlydba/sqlserver/.github/dependabot.yml new file mode 100644 index 000000000..443cf3bec --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/dependabot.yml @@ -0,0 +1,8 @@ +# Set update schedule for GitHub Actions +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "daily" diff --git a/ansible_collections/lowlydba/sqlserver/.github/in-solidarity.yml b/ansible_collections/lowlydba/sqlserver/.github/in-solidarity.yml new file mode 100644 index 000000000..6079dc1aa --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/in-solidarity.yml @@ -0,0 +1,8 @@ +rules: + master: + level: warning +ignore: + - ".github/in-solidarity.yml" # default + - "**/*.yml" + - "tests/integration/targets/setup_sqlserver_test_plugins/connection_plugins/local_pwsh.py" + - "tests/integration/targets/setup_sqlserver_test_plugins/module_utils/Ansible.ModuleUtils.AddType.psm1" diff --git a/ansible_collections/lowlydba/sqlserver/.github/workflows/ansible-test-windows.yml b/ansible_collections/lowlydba/sqlserver/.github/workflows/ansible-test-windows.yml new file mode 100644 index 000000000..a30426d3d --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/workflows/ansible-test-windows.yml @@ -0,0 +1,193 @@ +name: CI (Windows) +on: + # Manual triggers + workflow_dispatch: + # Run CI against all pushes (direct commits, also merged PRs), Pull Requests + push: + branches: + - main + - stable-* + paths-ignore: + - .github/workflows/docs*.yml + - .github/workflows/github-release.yml + - changelogs/fragments/*.yml + - .vscode/* + pull_request: + paths-ignore: + - .github/workflows/docs*.yml + - .github/workflows/github-release.yml + - changelogs/fragments/*.yml + - .vscode/* + + # Run CI once per day (at 06:00 UTC) + # This ensures that even if there haven't been commits that we are still testing against latest version of ansible-test for each ansible-base version + schedule: + - cron: "0 6 * * *" + +# Cancel existing runs on new commits to a branch +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + NAMESPACE: lowlydba + COLLECTION_NAME: sqlserver + DBATOOLS_VERSION: "1.1.112" + +jobs: + ### + # Integration tests (RECOMMENDED) + # + # https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html + + integration: + runs-on: ${{ matrix.os }} + name: I (Ⓐ${{ matrix.ansible }}+${{ matrix.os }}|grp${{ matrix.group }}) + strategy: + fail-fast: false + matrix: + os: + - windows-2019 + ansible: + - stable-2.11 + - stable-2.12 + - stable-2.13 + - stable-2.14 + - devel + group: # windows/group/#/ + - "1" + - "2" + #- '3' + + defaults: + run: + shell: wsl-bash {0} + + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Create an admin user + shell: cmd + run: | + net user admin pass123@ /add /y + net localgroup Administrators admin /add + + - name: Set up the runner for PowerShell remoting + shell: powershell + run: | + $sb = [ScriptBlock]::Create((New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1')) + & $sb -Verbose -ForceNewSSLCert 4>&1 + + - name: Enable winrm + shell: powershell + run: | + winrm quickconfig -force + + - name: Why is MongoDB running? Disable it. + shell: powershell + run: | + Get-Service -Name MongoDB | Where-Object Status -eq 'Running' | Stop-Service -Force + + - name: Install a SQL Server + continue-on-error: true + id: mssqlsuite + uses: potatoqualitee/mssqlsuite@v1.7 + with: + install: sqlengine + sa-password: L0wlydb4 + version: 2022 + + - name: Retry SQL Server install + id: retry1 + if: steps.mssqlsuite.outcome == 'failure' + uses: potatoqualitee/mssqlsuite@v1.7 + with: + install: sqlengine + sa-password: L0wlydb4 + version: 2022 + + - name: Add a hosts entry + shell: cmd + run: echo 127.0.0.1 sqlserver >> "%WinDir%\System32\Drivers\etc\hosts" + + - name: Install and cache PowerShell modules + uses: potatoqualitee/psmodulecache@v5.2 + with: + modules-to-cache: dbatools + shell: powershell + + - uses: Vampire/setup-wsl@v1.3.4 + with: + distribution: Debian + additional-packages: | + git + python3 + python3-pip + openssh-client + + - name: Get Linux workspace path + shell: pwsh + run: | + # $ws = & wslpath --% -u -a "${{ github.workspace }}"" + # seems wslpath is not available on server 2019 + + function ConvertTo-LinuxPathCrappy { + [CmdletBinding()] + param( + [Parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] + $LiteralPath + ) + + End { + $resolved = Resolve-Path -LiteralPath $LiteralPath + $drive = ($resolved | Split-Path -Qualifier).TrimEnd(':').ToLower() + $rooted = ($resolved | Split-Path -NoQualifier).Replace('\', '/').TrimStart('/') + + '/mnt/{0}/{1}' -f $drive, $rooted + } + } + $ws = ConvertTo-LinuxPathCrappy -LiteralPath "${{ github.workspace }}" + Add-Content -LiteralPath $env:GITHUB_ENV -Value "GHWS=$ws" + + - name: Install ansible-base (${{ matrix.ansible }}) + run: | + python3 -m pip install --upgrade pip setuptools pypsrp --disable-pip-version-check --retries 10 + python3 -m pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check --retries 10 + + - name: Install collection dependencies + id: collection-dependency + run: ansible-galaxy collection install ansible.windows -p "${{ env.GHWS }}" + continue-on-error: true + + - name: Retry install collection dependencies + if: steps.collection-dependency.outcome == 'failure' + run: ansible-galaxy collection install ansible.windows -p "${{ env.GHWS }}" + + - name: Set integration test options + shell: bash + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/tests/integration + run: | + cp integration_config.sample.yml integration_config.yml + cp inventory.winrm.ci inventory.winrm + + # Run the integration tests + - name: Run integration test + run: | + pushd "${{ env.GHWS }}/ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}" + ansible-test windows-integration -v --color --retry-on-error --continue-on-error --diff --coverage --requirements windows/group/${{ matrix.group }}/ + + # ansible-test support producing code coverage data + - name: Generate coverage report + run: | + pushd "${{ env.GHWS }}/ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}" + ansible-test coverage xml -v --requirements + + # See the reports at https://codecov.io/gh/lowlydba/lowlydba.sqlserver + - uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: false diff --git a/ansible_collections/lowlydba/sqlserver/.github/workflows/ansible-test.yml b/ansible_collections/lowlydba/sqlserver/.github/workflows/ansible-test.yml new file mode 100644 index 000000000..01f271845 --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/workflows/ansible-test.yml @@ -0,0 +1,172 @@ +# README FIRST +# 1. replace "NAMESPACE" and "COLLECTION_NAME" with the correct name in the env section (e.g. with 'community' and 'mycollection') +# 2. If you don't have unit tests remove that section +# 3. If your collection depends on other collections ensure they are installed, see "Install collection dependencies" +# If you need help please ask in #ansible-community on the Libera.chat IRC network + +name: CI +on: + # Manual triggers + workflow_dispatch: + # Run CI against all pushes (direct commits, also merged PRs), Pull Requests + push: + branches: + - main + - stable-* + paths-ignore: + - .github/workflows/docs*.yml + - .github/workflows/github-release.yml + - changelogs/fragments/*.yml + - .vscode/* + pull_request: + paths-ignore: + - .github/workflows/docs*.yml + - .github/workflows/github-release.yml + - changelogs/fragments/*.yml + - .vscode/* + + # Run CI once per day (at 06:00 UTC) + # This ensures that even if there haven't been commits that we are still testing against latest version of ansible-test for each ansible-base version + schedule: + - cron: "0 6 * * *" + +# Cancel existing runs on new commits to a branch +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + NAMESPACE: lowlydba + COLLECTION_NAME: sqlserver + +jobs: + ### + # Sanity tests (REQUIRED) + # + # https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html + + sanity: + name: Sanity (Ⓐ${{ matrix.ansible }}) + strategy: + matrix: + ansible: + # It's important that Sanity is tested against all stable-X.Y branches + # Testing against `devel` may fail as new tests are added. + - stable-2.11 + - stable-2.12 + - stable-2.13 + - stable-2.14 + - devel + runs-on: ubuntu-latest + steps: + # ansible-test requires the collection to be in a directory in the form + # .../ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/ + + - name: Check out code + uses: actions/checkout@v3 + with: + path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Set up Python + uses: actions/setup-python@v4 + with: + # it is just required to run that once as "ansible-test sanity" in the docker image + # will run on all python versions it supports. + python-version: 3.9 + + # Install the head of the given branch (devel, stable-2.10) + - name: Install ansible-base (${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check --retries 10 + + # run ansible-test sanity inside of Docker. + # The docker container has all the pinned dependencies that are required + # and all python versions ansible supports. + - name: Run sanity tests + run: ansible-test sanity --docker -v --color --coverage + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + # ansible-test support producing code coverage date + - name: Generate coverage report + run: ansible-test coverage xml -v --requirements --group-by command --group-by version + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + # See the reports at https://codecov.io/gh/lowlydba/lowlydba.sqlserver + - uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: false + + ### + # Integration tests (RECOMMENDED) + # + # https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html + + # If the application you are testing is available as a docker container and you want to test + # multiple versions see the following for an example: + # https://github.com/ansible-collections/community.zabbix/tree/master/.github/workflows + + integration: + runs-on: ubuntu-latest + name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}) + services: + sqlserver: + image: mcr.microsoft.com/mssql/server:2022-latest + ports: + - 1433:1433 + env: + ACCEPT_EULA: "Y" + SA_PASSWORD: L0wlydb4 + strategy: + fail-fast: false + matrix: + ansible: + - stable-2.11 + - stable-2.12 + - stable-2.13 + - stable-2.14 + - devel + python: + - 3.9 + + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Set up Python + uses: actions/setup-python@v4 + with: + # it is just required to run that once as "ansible-test integration" in the docker image + # will run on all python versions it supports. + python-version: 3.9 + + - name: Install ansible-base (${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check --retries 10 + + - name: Install collection dependencies + id: collection-dependency + run: ansible-galaxy collection install community.general -p . + continue-on-error: true + + - name: Retry install collection dependencies + if: steps.collection-dependency.outcome == 'failure' + run: ansible-galaxy collection install community.general -p . + + - name: Set integration test options + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/tests/integration + run: cp integration_config.sample.yml integration_config.yml + + # Run the integration tests + - name: Run integration test + run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --docker-network="${{ job.services.sqlserver.network }}" --coverage + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + # ansible-test support producing code coverage date + - name: Generate coverage report + run: ansible-test coverage xml -v --requirements + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + # See the reports at https://codecov.io/gh/lowlydba/lowlydba.sqlserver + - uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: false diff --git a/ansible_collections/lowlydba/sqlserver/.github/workflows/docs-pr.yml b/ansible_collections/lowlydba/sqlserver/.github/workflows/docs-pr.yml new file mode 100644 index 000000000..7bfe7c531 --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/workflows/docs-pr.yml @@ -0,0 +1,88 @@ +name: Collection Docs +concurrency: + group: docs-pr-${{ github.head_ref }} + cancel-in-progress: true +on: + pull_request_target: + types: [opened, synchronize, reopened, closed] + +env: + GHP_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} + +jobs: + validate-docs: + permissions: + contents: read + name: Validate Ansible Docs + if: github.event.action != 'closed' + uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-push.yml@main + with: + artifact-upload: false + init-lenient: false + init-fail-on-error: true + build-ref: refs/pull/${{ github.event.number }}/merge + + build-docs: + permissions: + contents: read + name: Build Ansible Docs + uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-pr.yml@main + with: + init-lenient: true + init-fail-on-error: false + render-file-line: '> * `$` [$](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr/${{ github.event.number }}/$)' + + publish-docs-gh-pages: + # for now we won't run this on forks + if: github.repository == 'lowlydba/lowlydba.sqlserver' + permissions: + contents: write + needs: [build-docs] + name: Publish Ansible Docs + uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@main + with: + artifact-name: ${{ needs.build-docs.outputs.artifact-name }} + action: ${{ (github.event.action == 'closed' || needs.build-docs.outputs.changed != 'true') && 'teardown' || 'publish' }} + secrets: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + comment: + permissions: + pull-requests: write + runs-on: ubuntu-latest + needs: [publish-docs-gh-pages, build-docs] + name: PR comments + steps: + - name: PR comment + uses: ansible-community/github-docs-build/actions/ansible-docs-build-comment@main + with: + body-includes: '## Docs Build' + reactions: heart + action: ${{ needs.build-docs.outputs.changed != 'true' && 'remove' || '' }} + on-closed-action: remove + on-merged-body: | + ## Docs Build 📝 + + Thank you for contribution!✨ + + This PR has been merged and the docs are now incorporated into `main`: + ${{ env.GHP_BASE_URL }}/branch/main + body: | + ## Docs Build 📝 + + Thank you for contribution!✨ + + The docs for **this PR** have been published here: + ${{ env.GHP_BASE_URL }}/pr/${{ github.event.number }} + + You can compare to the docs for the `main` branch here: + ${{ env.GHP_BASE_URL }}/branch/main + + The docsite for **this PR** is also available for download as an artifact from this run: + ${{ needs.build-docs.outputs.artifact-url }} + + File changes: + + ${{ needs.build-docs.outputs.diff-files-rendered }} + + ${{ needs.build-docs.outputs.diff-rendered }} diff --git a/ansible_collections/lowlydba/sqlserver/.github/workflows/docs-push.yml b/ansible_collections/lowlydba/sqlserver/.github/workflows/docs-push.yml new file mode 100644 index 000000000..3a152d0c0 --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/workflows/docs-push.yml @@ -0,0 +1,35 @@ +name: Collection Docs +concurrency: + group: docs-push-${{ github.sha }} + cancel-in-progress: true +on: + push: + branches: + - main + tags: + - '*' + schedule: + - cron: '0 13 * * *' + +jobs: + build-docs: + permissions: + contents: read + name: Build Ansible Docs + uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-push.yml@main + with: + init-lenient: false + init-fail-on-error: true + + publish-docs-gh-pages: + # for now we won't run this on forks + if: github.repository == 'lowlydba/lowlydba.sqlserver' + permissions: + contents: write + needs: [build-docs] + name: Publish Ansible Docs + uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@main + with: + artifact-name: ${{ needs.build-docs.outputs.artifact-name }} + secrets: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/ansible_collections/lowlydba/sqlserver/.github/workflows/release.yml b/ansible_collections/lowlydba/sqlserver/.github/workflows/release.yml new file mode 100644 index 000000000..f7a3a9dec --- /dev/null +++ b/ansible_collections/lowlydba/sqlserver/.github/workflows/release.yml @@ -0,0 +1,79 @@ +name: GitHub Release +on: + workflow_dispatch: + inputs: + version: + description: "Version number to release" + required: true + +env: + GHP_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} + +jobs: + release: + name: Create GitHub Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + + - name: Install PyYaml + run: pip install pyyaml + + - name: Publish to Galaxy + uses: artis3n/ansible_galaxy_collection@v2.8.2 + with: + api_key: ${{ secrets.GALAXY_API_KEY }} + + - name: Validate version is published to Galaxy + run: curl --head -s -f -o /dev/null https://galaxy.ansible.com/download/lowlydba-sqlserver-${{ github.event.inputs.version }}.tar.gz + + - name: Build release description + shell: python + run: | + import os + import yaml + + ver = '${{ github.event.inputs.version }}' + ver_anchor = str.replace(ver, '.', '-') + + with open('changelogs/changelog.yaml', 'r') as s: + ri = yaml.safe_load(s) + + if ('release_summary' not in ri['releases'][ver]['changes']): + summary = 'No release summary available.' + else: + summary = ri['releases'][ver]['changes']['release_summary'] + + reldate = ri['releases'][ver]['release_date'] + + description = '''## Summary + Released: %s + + %s + + --- + + View the [complete changelog](https://github.com/lowlydba/lowlydba.sqlserver/blob/main/CHANGELOG.rst#v%s) to see all changes. + + View the [full documentation for release ${{ github.event.inputs.version }}](${{ env.GHP_BASE_URL }}/tag/${{ github.event.inputs.version }}). + ''' % (reldate, summary, ver_anchor) + + with open(os.environ['GITHUB_ENV'], 'a') as e: + e.write("RELEASE_DESCRIPTION<