diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90bd739..f5624db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,141 +1,141 @@ -name: CI - -concurrency: - group: ci-${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -on: - pull_request: - branches: [master] - paths-ignore: - &paths-ignore # Documentation (NOT docs/** - that's PlatyPS source!) - - "CHANGELOG.md" - - "LICENSE" - # AI assistant instruction files - - "AGENTS.md" - - "CLAUDE.md" - - "GEMINI.md" - - ".cursor/**" - - ".github/copilot-instructions.md" - - ".github/ai-context/**" - - ".github/instructions/**" - # GitHub/editor meta files - - ".github/*.md" - - ".github/ISSUE_TEMPLATE/**" - - ".github/PULL_REQUEST_TEMPLATE/**" - - ".vscode/**" - - ".editorconfig" - - ".spelling" - # Untracked regenerated docs (kept in case they ever land) - - "docs-regenerated/**" - push: - branches: [master] - paths-ignore: *paths-ignore - workflow_dispatch: - -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@9a9367e22847bd24f86208ed2d98d207b0e2a3b3 # v0.1.6 - - - run: Invoke-Build -Task Lint - shell: pwsh - - build: - name: Build Module - needs: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@9a9367e22847bd24f86208ed2d98d207b0e2a3b3 # v0.1.6 - - - run: Invoke-Build -Task Clean, Build - shell: pwsh - - - uses: actions/upload-artifact@v7 - with: - name: Release - path: ./Release/ - - test_windows_ps5: - name: Test (Windows PS5) - needs: build - runs-on: windows-latest - steps: - - uses: actions/checkout@v6 - - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@9a9367e22847bd24f86208ed2d98d207b0e2a3b3 # v0.1.6 - with: - ps-version: "5" - # Setup is run below in the powershell (PS 5.1) shell instead of pwsh, - # so the Windows PowerShell module path is populated. - skip-setup: "true" - - - uses: actions/download-artifact@v8 - with: - name: Release - path: ./Release/ - - - name: Setup - shell: powershell - run: | - ./Tools/setup.ps1 - Invoke-Build -Task ShowDebugInfo - - - run: Invoke-Build -Task Test - shell: powershell - - - uses: actions/upload-artifact@v7 - if: always() - with: - name: Windows-PS5-Unit-Tests - path: Test*.xml - - test_pwsh: - name: Test (${{ matrix.name }}) - needs: build - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - { os: windows-latest, name: "Windows PS7" } - - { os: ubuntu-latest, name: "Ubuntu" } - - { os: macos-latest, name: "macOS" } - steps: - - uses: actions/checkout@v6 - - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@9a9367e22847bd24f86208ed2d98d207b0e2a3b3 # v0.1.6 - - - uses: actions/download-artifact@v8 - with: - name: Release - path: ./Release/ - - - run: Invoke-Build -Task Test - shell: pwsh - - - uses: actions/upload-artifact@v7 - if: always() - with: - name: ${{ matrix.name }}-Unit-Tests - path: Test*.xml - - ci-required: - name: CI Result - if: always() - needs: [lint, build, test_windows_ps5, test_pwsh] - runs-on: ubuntu-latest - steps: - - name: Aggregate job results - shell: bash - run: | - results='${{ toJSON(needs) }}' - echo "Job results:" - echo "$results" - if echo "$results" | grep -E '"result":[[:space:]]*"(failure|cancelled)"' > /dev/null; then - echo "::error::One or more required jobs failed or were cancelled." - exit 1 - fi - echo "All required jobs passed or were skipped." +name: CI + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +on: + pull_request: + branches: [master] + paths-ignore: + &paths-ignore # Documentation (NOT docs/** - that's PlatyPS source!) + - "CHANGELOG.md" + - "LICENSE" + # AI assistant instruction files + - "AGENTS.md" + - "CLAUDE.md" + - "GEMINI.md" + - ".cursor/**" + - ".github/copilot-instructions.md" + - ".github/ai-context/**" + - ".github/instructions/**" + # GitHub/editor meta files + - ".github/*.md" + - ".github/ISSUE_TEMPLATE/**" + - ".github/PULL_REQUEST_TEMPLATE/**" + - ".vscode/**" + - ".editorconfig" + - ".spelling" + # Untracked regenerated docs (kept in case they ever land) + - "docs-regenerated/**" + push: + branches: [master] + paths-ignore: *paths-ignore + workflow_dispatch: + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@b95fd4d1ad0fca24905a38be4db70da7eeff8cb0 # v0.1.12 + + - run: Invoke-Build -Task Lint + shell: pwsh + + build: + name: Build Module + needs: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@b95fd4d1ad0fca24905a38be4db70da7eeff8cb0 # v0.1.12 + + - run: Invoke-Build -Task Clean, Build + shell: pwsh + + - uses: actions/upload-artifact@v7 + with: + name: Release + path: ./Release/ + + test_windows_ps5: + name: Test (Windows PS5) + needs: build + runs-on: windows-latest + steps: + - uses: actions/checkout@v6 + - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@b95fd4d1ad0fca24905a38be4db70da7eeff8cb0 # v0.1.12 + with: + ps-version: "5" + # Setup is run below in the powershell (PS 5.1) shell instead of pwsh, + # so the Windows PowerShell module path is populated. + skip-setup: "true" + + - uses: actions/download-artifact@v8 + with: + name: Release + path: ./Release/ + + - name: Setup + shell: powershell + run: | + ./Tools/setup.ps1 + Invoke-Build -Task ShowDebugInfo + + - run: Invoke-Build -Task Test + shell: powershell + + - uses: actions/upload-artifact@v7 + if: always() + with: + name: Windows-PS5-Unit-Tests + path: Test*.xml + + test_pwsh: + name: Test (${{ matrix.name }}) + needs: build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - { os: windows-latest, name: "Windows PS7" } + - { os: ubuntu-latest, name: "Ubuntu" } + - { os: macos-latest, name: "macOS" } + steps: + - uses: actions/checkout@v6 + - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@b95fd4d1ad0fca24905a38be4db70da7eeff8cb0 # v0.1.12 + + - uses: actions/download-artifact@v8 + with: + name: Release + path: ./Release/ + + - run: Invoke-Build -Task Test + shell: pwsh + + - uses: actions/upload-artifact@v7 + if: always() + with: + name: ${{ matrix.name }}-Unit-Tests + path: Test*.xml + + ci-required: + name: CI Result + if: always() + needs: [lint, build, test_windows_ps5, test_pwsh] + runs-on: ubuntu-latest + steps: + - name: Aggregate job results + shell: bash + run: | + results='${{ toJSON(needs) }}' + echo "Job results:" + echo "$results" + if echo "$results" | grep -E '"result":[[:space:]]*"(failure|cancelled)"' > /dev/null; then + echo "::error::One or more required jobs failed or were cancelled." + exit 1 + fi + echo "All required jobs passed or were skipped." diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index d83312d..11b3482 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -1,16 +1,16 @@ -name: "Copilot Setup Steps" - -on: - workflow_dispatch: - -jobs: - copilot-setup-steps: - runs-on: ubuntu-latest - - permissions: - contents: read - - steps: - - uses: actions/checkout@v6 - - - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@9a9367e22847bd24f86208ed2d98d207b0e2a3b3 # v0.1.6 +name: "Copilot Setup Steps" + +on: + workflow_dispatch: + +jobs: + copilot-setup-steps: + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - uses: actions/checkout@v6 + + - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@b95fd4d1ad0fca24905a38be4db70da7eeff8cb0 # v0.1.12 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9865825..5dac7f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,86 +1,86 @@ -name: Create Release and Publish - -on: - push: - tags: - - "v*" - workflow_dispatch: - inputs: - release_tag: - description: "Tag to release (for manual reruns)" - required: true - type: string - -jobs: - release: - name: Release - runs-on: ubuntu-latest - permissions: - actions: read - contents: write - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - ref: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.ref_name }} - - - name: Resolve release ref - id: release_ref - shell: bash - run: | - if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - release_tag="${{ inputs.release_tag }}" - else - release_tag="${{ github.ref_name }}" - fi - - release_sha="$(git rev-list -n 1 "$release_tag")" - echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT" - echo "release_sha=$release_sha" >> "$GITHUB_OUTPUT" - - - name: Download artifact from tagged commit CI run - uses: dawidd6/action-download-artifact@v21 - with: - workflow: ci.yml - workflow_conclusion: success - commit: ${{ steps.release_ref.outputs.release_sha }} - name: Release - path: ./Release/ - if_no_artifact_found: fail - - - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@9a9367e22847bd24f86208ed2d98d207b0e2a3b3 # v0.1.6 - - - name: Publish module - run: Invoke-Build -Task Publish -VersionToPublish ${{ steps.release_ref.outputs.release_tag }} - -PSGalleryAPIKey ${{ secrets.PSGALLERY_API_KEY }} - shell: pwsh - - - name: Cherry pick CHANGELOG.md - id: changelog - uses: MatteoCampinoti94/changelog-to-release@v1.0.6 - with: - version-name: ${{ steps.release_ref.outputs.release_tag }} - configuration: ./.github/changelog.configuration.json - if: ${{ hashFiles('CHANGELOG.md') != '' }} - - - name: Create Release and Upload Asset - uses: softprops/action-gh-release@v3 - with: - body: ${{ steps.changelog.outputs.body }} - tag_name: ${{ steps.release_ref.outputs.release_tag }} - name: ${{ steps.release_ref.outputs.release_tag }} - files: ./Release/AtlassianPS.Configuration.zip - fail_on_unmatched_files: true - draft: false - prerelease: ${{ contains(steps.release_ref.outputs.release_tag, 'alpha') || contains(steps.release_ref.outputs.release_tag, 'beta') || contains(steps.release_ref.outputs.release_tag, 'rc') }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Notify homepage to update submodule - if: ${{ !contains(steps.release_ref.outputs.release_tag, 'alpha') && !contains(steps.release_ref.outputs.release_tag, 'beta') && !contains(steps.release_ref.outputs.release_tag, 'rc') }} - uses: peter-evans/repository-dispatch@v4 - with: - token: ${{ secrets.HOMEPAGE_PAT }} - repository: AtlassianPS/AtlassianPS.github.io - event-type: module-release - client-payload: "{\"module\": \"AtlassianPS.Configuration\", \"version\": \"${{ steps.release_ref.outputs.release_tag }}\"}" +name: Create Release and Publish + +on: + push: + tags: + - "v*" + workflow_dispatch: + inputs: + release_tag: + description: "Tag to release (for manual reruns)" + required: true + type: string + +jobs: + release: + name: Release + runs-on: ubuntu-latest + permissions: + actions: read + contents: write + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.ref_name }} + + - name: Resolve release ref + id: release_ref + shell: bash + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + release_tag="${{ inputs.release_tag }}" + else + release_tag="${{ github.ref_name }}" + fi + + release_sha="$(git rev-list -n 1 "$release_tag")" + echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT" + echo "release_sha=$release_sha" >> "$GITHUB_OUTPUT" + + - name: Download artifact from tagged commit CI run + uses: dawidd6/action-download-artifact@v21 + with: + workflow: ci.yml + workflow_conclusion: success + commit: ${{ steps.release_ref.outputs.release_sha }} + name: Release + path: ./Release/ + if_no_artifact_found: fail + + - uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@b95fd4d1ad0fca24905a38be4db70da7eeff8cb0 # v0.1.12 + + - name: Publish module + run: Invoke-Build -Task Publish -VersionToPublish ${{ steps.release_ref.outputs.release_tag }} + -PSGalleryAPIKey ${{ secrets.PSGALLERY_API_KEY }} + shell: pwsh + + - name: Cherry pick CHANGELOG.md + id: changelog + uses: MatteoCampinoti94/changelog-to-release@v1.0.6 + with: + version-name: ${{ steps.release_ref.outputs.release_tag }} + configuration: ./.github/changelog.configuration.json + if: ${{ hashFiles('CHANGELOG.md') != '' }} + + - name: Create Release and Upload Asset + uses: softprops/action-gh-release@v3 + with: + body: ${{ steps.changelog.outputs.body }} + tag_name: ${{ steps.release_ref.outputs.release_tag }} + name: ${{ steps.release_ref.outputs.release_tag }} + files: ./Release/AtlassianPS.Configuration.zip + fail_on_unmatched_files: true + draft: false + prerelease: ${{ contains(steps.release_ref.outputs.release_tag, 'alpha') || contains(steps.release_ref.outputs.release_tag, 'beta') || contains(steps.release_ref.outputs.release_tag, 'rc') }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Notify homepage to update submodule + if: ${{ !contains(steps.release_ref.outputs.release_tag, 'alpha') && !contains(steps.release_ref.outputs.release_tag, 'beta') && !contains(steps.release_ref.outputs.release_tag, 'rc') }} + uses: peter-evans/repository-dispatch@v4 + with: + token: ${{ secrets.HOMEPAGE_PAT }} + repository: AtlassianPS/AtlassianPS.github.io + event-type: module-release + client-payload: "{\"module\": \"AtlassianPS.Configuration\", \"version\": \"${{ steps.release_ref.outputs.release_tag }}\"}"