Skip to content

Commit

Permalink
Various changes, support for Shlink 3, see CHANGELOG.md +semver: minor
Browse files Browse the repository at this point in the history
  • Loading branch information
codaamok committed Feb 13, 2022
1 parent cabd9a4 commit cc2690b
Show file tree
Hide file tree
Showing 33 changed files with 335 additions and 256 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: "Create GitHub release and publish to the PowerShell Gallery"
on:
push:
paths:
- 'PSShlink/**'
- '!PSShlink/tests/**'
- 'src/**'
branches:
- main
- master
Expand Down Expand Up @@ -36,15 +35,28 @@ jobs:
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Install-Module "InvokeBuild" -Force
$Username, $ProjectName = $env:GITHUB_REPOSITORY -split "/"
Invoke-Build -ModuleName $ProjectName -Author $Username -Task "InstallDependencies","ImportBuildModule","SetGitHubActionEnvironmentVariables"
Invoke-Build -File "invoke.build.ps1" -ModuleName $ProjectName -Author $Username -Task "InstallDependencies","ImportBuildModule","SetGitHubActionEnvironmentVariables"
shell: pwsh

- name: Build
run: Invoke-Build -ModuleName $env:GH_PROJECTNAME -Author $env:GH_USERNAME -Version $env:GitVersion_SemVer -NewRelease $true
run: |
$Params = @{
ModuleName = $env:GH_PROJECTNAME
Author = $env:GH_USERNAME
Version = $env:GitVersion_SemVer
NewRelease = $true
}
Invoke-Build -File "custom.build.ps1" @Params -Task PreBuild
Invoke-Build -File "invoke.build.ps1" @Params
Invoke-Build -File "custom.build.ps1" @Params -Task PostBuild
shell: pwsh

- name: Custom pre-release tasks
run: Invoke-Build -File "custom.build.ps1" -ModuleName $env:GH_PROJECTNAME -Author $env:GH_USERNAME -Version $env:GitVersion_SemVer -NewRelease $true -Task PreRelease
shell: pwsh

- name: Publish to PowerShell Gallery
run: Invoke-Build -ModuleName $env:GH_PROJECTNAME -Task "PublishModule"
run: Invoke-Build -File "invoke.build.ps1" -ModuleName $env:GH_PROJECTNAME -Task "PublishModule"
shell: pwsh
env:
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
Expand Down Expand Up @@ -76,10 +88,14 @@ jobs:
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git add CHANGELOG.md ${GH_PROJECTNAME}/${GH_PROJECTNAME}.psd1 docs
git add CHANGELOG.md src/${GH_PROJECTNAME}.psd1 docs
git commit -m "Released ${{ env.GitVersion_SemVer }}"
- name: Push commit
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Custom post-release tasks
run: Invoke-Build -File "custom.build.ps1" -ModuleName $env:GH_PROJECTNAME -Author $env:GH_USERNAME -Version $env:GitVersion_SemVer -NewRelease $true -Task PostRelease
shell: pwsh
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file does not start with a period in the codaamok.build FileList because there seems to be an issue with using files in a module manifest's FileList starting with a period
build/*
release/*
!*.gitkeep
release/*
.DS_Store
44 changes: 44 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,49 @@
},
"problemMatcher": []
},
{
"label": "Tests",
"type": "process",
"command": "pwsh",
"args": ["-noprofile","-command","Import-Module ${input:CodeType}; $env:ShlinkServer = '${input:ShlinkServer}'; $env:ShlinkAPIKey = '${input:ShlinkAPIKey}' | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString; Invoke-Pester -Path './tests/*' -Output Detailed"],
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"problemMatcher": []
},
],
"inputs": [
{
"description": "Please enter Shlink server name",
"id": "ShlinkServer",
"type": "promptString",
"default": "https://acook.io"
},
{
"description": "Please enter Shlink API key",
"id": "ShlinkAPIKey",
"type": "promptString",
"default": "",
"password": true,
},
{
"type": "pickString",
"id": "CodeType",
"description": "Would you like use built, or development code?",
"options": [
"./src/PSShlink.psd1",
"./build/PSShlink/PSShlink.psd1"
],
"default": "./src/PSShlink.psd1"
},
]
}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Function `Get-ShlinkUrl` has new parameter `-TagsMode`, new in Shlink 3.0.0
- Function `Get-ShlinkTags` has new parameter `-SearchTerm`, new in Shlink 3.0.0
- New function `Get-ShlinkVisitsNonOrphan`, new endpoint in Shlink 3.0.0
- New parameter `-RoundBlockSize` for `Save-ShlinkUrlQrCode`

### Changed
- `Get-ShlinkTags` uses the new `/tags/stats` endpoint to include stats in the data returned. This change is purely internal of the function, does not impact how the function is used or how the data is returned.
- `Get-ShlinkDomains` now includes two parent properties when data is returned: `data` and `defaultRedirects`. In Shlink 2.10.0, this endpoint was updated to include the `defaultRedirects` property. Previously, all that was returned was everything within the `data` property.
- New parameter set of possible values for `-OrderBy` parameter of `Get-ShlinkUrl` function: `longUrl-ASC`, `longUrl-DESC`, `shortCode-ASC`, `shortCode-DESC`, `dateCreated-ASC`, `dateCreated-DESC`, `visits-ASC`, `visits-DESC`, `title-ASC`, and `title-DESC`

### Removed
- Function `New-ShlinKTag` as the endpoint was removed from Shlink REST API in 3.0.0

### Fixed
- `Remove-ShlinkTag` ShouldProcess prompts listed the entire array of tags passed to it, rather than the current iterable it was working on

## [0.8.2] - 2021-11-21
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ git fetch upstream
# If there are changes, pull and work on merge conflicts
git pull --rebase upstream develop
```
4. Make sure you have pushed your commits to your new branch and then create a pull request
6. Make sure you have pushed your commits to your new branch and then create a pull request
Binary file removed PSShlink/.DS_Store
Binary file not shown.
31 changes: 0 additions & 31 deletions PSShlink/PSShlink.Format.ps1xml

This file was deleted.

62 changes: 0 additions & 62 deletions PSShlink/Public/New-ShlinkTag.ps1

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ An unofficial PowerShell module for Shlink (https://shlink.io), an open-source s
- [Get-ShlinkTags](docs/Get-ShlinkTags.md)
- [Get-ShlinkUrl](docs/Get-ShlinkUrl.md)
- [Get-ShlinkVisits](docs/Get-ShlinkVisits.md)
- [Get-ShlinkVisitsNonOrphan](docs/Get-ShlinkVisitsNonOrphan.md)
- [Get-ShlinkVisitsOrphan](docs/Get-ShlinkVisitsOrphan.md)
- [New-ShlinkTag](docs/New-ShlinkTag.md)
- [New-ShlinkUrl](docs/New-ShlinkUrl.md)
- [Remove-ShlinkTag](docs/Remove-ShlinkTag.md)
- [Remove-ShlinkUrl](docs/Remove-ShlinkUrl.md)
Expand All @@ -26,7 +26,7 @@ An unofficial PowerShell module for Shlink (https://shlink.io), an open-source s
## Requirements

- PowerShell 5.1 or newer (including PowerShell Core, 7.0 or newer)
- Shlink 2.9.0 or newer
- Shlink 3.0.0 or newer
- If you need support for older versions of Shlink, you can still source older versions of PSShlink [here](https://github.com/codaamok/PSShlink/releases) or use the `-RequiredVersion` parameter of `Install-Module` when installed from the PowerShell Gallery

## Getting started
Expand Down
40 changes: 40 additions & 0 deletions custom.build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<#
.SYNOPSIS
Build script which leverages the InvokeBuild module.
.DESCRIPTION
Build script which leverages the InvokeBuild module.
This build script is used in the build pipeline and local development for building this project.
Invoked by invoke.build.ps1 in this project where its intent is to implement project-specific custom pre/post build actions during the build pipeline andds local development.
#>
[CmdletBinding()]
param (
[Parameter()]
[ValidateNotNullOrEmpty()]
[String]$ModuleName,

[Parameter()]
[ValidateNotNullOrEmpty()]
[String]$Author,

[Parameter()]
[String]$Version,

[Parameter()]
[Bool]$NewRelease
)

task PreBuild {

}

task PostBuild {

}

task PreRelease {

}

task PostRelease {

}
Loading

0 comments on commit cc2690b

Please sign in to comment.