Skip to content

mdlopresti pull_request #22

mdlopresti pull_request

mdlopresti pull_request #22

run-name: ${{ github.actor }} ${{ github.event_name }}
on:
push:
branches:
- feature/*
- main
pull_request:
branches:
- main
env:
SHELL: powershell
jobs:
validate:
runs-on: windows-latest
defaults:
run:
shell: ${{ env.SHELL }}
steps:
- uses: actions/checkout@v4
- name: Setup Environment
uses: "./.github/template/setup"
with:
shell: ${{ env.SHELL }}
- name: Validate
run: Invoke-Build validate
package:
needs: validate
runs-on: windows-latest
defaults:
run:
shell: ${{ env.SHELL }}
steps:
- uses: actions/checkout@v4
- name: Setup Environment
uses: "./.github/template/setup"
with:
shell: ${{ env.SHELL }}
- name: Generate Package
run: |
Invoke-Build clean
Invoke-Build generate_package -zipPackage $true
- name: Save Package
uses: actions/upload-artifact@v3
with:
name: package
path: dist/ValidateJson.zip
retention-days: 7
release:
needs: package
permissions:
contents: write
runs-on: windows-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
defaults:
run:
shell: ${{ env.SHELL }}
steps:
- uses: actions/download-artifact@v3
with:
name: package
- name: Get Version
id: version
run: |
Expand-Archive -Path package.zip
$versionNumber = (Import-PowerShellDataFile .\package\ValidateJson.psd1)["ModuleVersion"]
Write-Output "version_number=$versionNumber" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
Remove-Item -Path .\package\ -Force -Recurse
- name: Put Version Number in Package
run: Move-Item package.zip ValidateJson-${{ steps.version.outputs.version_number }}.zip
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref }} ${{ steps.version.outputs.version_number }}
prerelease: ${{ github.ref != 'refs/heads/main' }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
ValidateJson-${{ steps.version.outputs.version_number }}.zip