Skip to content

[Publish] - Update WinSCP Core to 6.3.4. #54

[Publish] - Update WinSCP Core to 6.3.4.

[Publish] - Update WinSCP Core to 6.3.4. #54

Workflow file for this run

name: CI/CD
# Controls when the workflow will run.
on:
# Triggers the workflow on push or pull request events but only for the "master" branch.
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:
env:
ModuleVersion: 6.3.3.1
ReleaseNotes: ${{ github.event.head_commit.message }}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel.
jobs:
build:
# The type of runner that the job will run on.
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job.
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
- name: Checkout repository
uses: actions/checkout@v3
# Setup and configure FileZilla FTP server to test aginst.
- name: Install FileZilla FTP server
shell: pwsh
run: . .\FileZilla\FileZilla_Server_Install.ps1
# Execute Pester tests.
- name: Execute Pester tests
shell: pwsh
run: |
Import-Module -Name Pester, PSScriptAnalyzer
Import-Module -Name .\WinSCP
Invoke-Pester -Path .\Tests\* | Export-Clixml -Path .\Pester.Tests.xml
# Upload Pester test results.
- name: Upload Pester test results
uses: actions/upload-artifact@v3
with:
name: testResults
path: .\Pester.Tests.xml
publish:
# Publish job only runs if the build job successeds, and if the commit message contains '[Publish]'
needs: build
if: contains(github.event.head_commit.message, '[Publish]')
# The type of runner that the job will run on.
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job.
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
- name: Checkout repository
uses: actions/checkout@v3
# Install Configuration module, used for publishing.
- name: Install Configuration module
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module -Name Configuration
# Update module metadata with relese version info and commit message as the "ReleaseNotes".
- name: Update module metadata
shell: pwsh
run: |
Import-Module -Name Configuration
Remove-Item -Path .\WinSCP\bin\winscp.ini -Force -Confirm:$false -ErrorAction SilentlyContinue
Update-Metadata -Path .\WinSCP\WinSCP.psd1 -PropertyName ModuleVersion -Value $env:ModuleVersion
Update-Metadata -Path .\WinSCP\WinSCP.psd1 -PropertyName ReleaseNotes -Value $env:ReleaseNotes
# Create and publish a new GitHub and PowerShell Gallery Release.
- name: Publish release
if: contains(github.event.head_commit.message, '[Publish]')
env:
NuGetApiKey : ${{ secrets.NUGET_API_KEY }}
shell: pwsh
run: |
Publish-Module -Path .\WinSCP -NuGetApiKey $env:NuGetApiKey
Compress-Archive -Path .\WinSCP\* -DestinationPath .\WinSCP.zip -CompressionLevel Optimal
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: WinSCP-PowerShell-v${{ env.ModuleVersion }}
prerelease: false
files: WinSCP.zip