Skip to content

Get-Diff: Add cmdlet #92

Get-Diff: Add cmdlet

Get-Diff: Add cmdlet #92

Workflow file for this run

name: TestAndTag
on:
push:
branches:
- master
pull_request:
branches:
- master
types: [opened, reopened, synchronize, labeled]
schedule:
- cron: '20 0 1 * *'
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PowerShell module cache
id: cacher
uses: actions/cache@v3
with:
path: "~/.local/share/powershell/Modules"
key: ${{ runner.os }}-Pester
- name: Install from PSGallery
if: steps.cacher.outputs.cache-hit != 'true'
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module Pester -RequiredVersion 4.10.0
- name: Invoke Tests
shell: pwsh
run: Tests/Invoke-Tests.ps1 -CodeCoveragePath ./gandt-azure-devops-tools/**/*.ps1
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v1
if: always()
with:
files: '**/TEST-*.xml'
- name: Check code coverage
shell: pwsh
run: Tests/Out-TestResults.ps1 -CoveragePercent 65 -Verbose
tag:
name: Push Git Tag
if: github.event_name != 'schedule'
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get merged PR
uses: actions-ecosystem/[email protected]
id: get-merged-pull-request
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get release label
uses: actions-ecosystem/[email protected]
id: release-label
if: ${{ steps.get-merged-pull-request.outputs.title != null }}
with:
labels: ${{ steps.get-merged-pull-request.outputs.labels }}
- name: Get latest tag
uses: actions-ecosystem/[email protected]
id: get-latest-tag
with:
semver_only: true
- name: Bump tag (default)
uses: actions-ecosystem/[email protected]
id: bump-semver-default
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: patch
- name: Bump tag (label)
uses: actions-ecosystem/[email protected]
id: bump-semver-label
if: ${{ steps.release-label.outputs.level != null }}
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: ${{ steps.release-label.outputs.level }}
- name: Set tag variable
run: |
if [ "${{ steps.bump-semver-label.outputs.new_version }}" ]; then
echo "new_version=${{ steps.bump-semver-label.outputs.new_version }}" >> $GITHUB_ENV
else
echo "new_version=${{ steps.bump-semver-default.outputs.new_version }}" >> $GITHUB_ENV
fi
- name: Push tag
uses: actions-ecosystem/[email protected]
if: ${{ success() && github.ref == 'refs/heads/master' }}
with:
tag: ${{ env.new_version }}