mdlopresti pull_request #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
run-name: ${{ github.actor }} ${{ github.event_name }} | |
on: | |
push: | |
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: Generate Module Manifest | |
run: Invoke-Build generate_manifest | |
- name: Show Directory Structure | |
run: Get-ChildItem . -Exclude .git -Recurse | Select-Object -ExpandProperty Fullname | |
- name: Set Version | |
id: version | |
run: | | |
$versionNumber = (Import-PowerShellDataFile .\src\ValidateJson.psd1)["ModuleVersion"] | |
Write-Output "version_number=$versionNumber" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- run: Write-Host "${{ steps.version.outputs.version_number }}" | |
- 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: Get Version | |
id: version | |
run: | | |
$versionNumber = (Import-PowerShellDataFile .\src\ValidateJson.psd1)["ModuleVersion"] | |
Write-Output "version_number=$versionNumber" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Save Package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: package | |
path: dist/ValidateJson.zip | |
retention-days: 7 | |
release: | |
needs: package | |
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 ValidateJson.zip | |
$versionNumber = (Import-PowerShellDataFile .\ValidateJson\ValidateJson.psd1)["ModuleVersion"] | |
Write-Output "version_number=$versionNumber" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
Remove-Item -Path .\ValidateJson\ -Force -Recurse | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} ${{ steps.version.outputs.version_number }} | |
prerelease: ${{ github.ref != 'refs/heads/main' }} | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/ValidateJson.zip | |
asset_name: ValidateJson-${{ steps.version.outputs.version_number }}.zip | |
asset_content_type: application/zip |