Correct workflows path
All checks were successful
Publish Powershell Module to Gitea Repository / deploy (push) Successful in 35s
All checks were successful
Publish Powershell Module to Gitea Repository / deploy (push) Successful in 35s
This commit is contained in:
90
.gitea/workflows/Publish Module.yaml
Normal file
90
.gitea/workflows/Publish Module.yaml
Normal file
@@ -0,0 +1,90 @@
|
||||
name: Publish Powershell Module to Gitea Repository
|
||||
run-name: ${{ gitea.actor }} is publishing module ${{ gitea.repository }} to Gitea
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*.*.*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: catthehacker/ubuntu:pwsh-latest
|
||||
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Register Gitea Repository
|
||||
shell: pwsh
|
||||
run: |
|
||||
$creds = New-Object System.Management.Automation.PSCredential('actions', ('{{ secrets.PACKAGES_TOKEN }}' | ConvertTo-SecureString -AsPlainText -Force))
|
||||
try {
|
||||
Register-PSRepository -Name 'GiteaPrivate' `
|
||||
-SourceLocation 'https://gitea.norwichct.tech/api/packages/cityofnorwich/nuget' `
|
||||
-PublishLocation 'https://gitea.norwichct.tech/api/packages/cityofnorwich/nuget' `
|
||||
-installationPolicy Trusted `
|
||||
-Credential $creds
|
||||
}
|
||||
catch {
|
||||
Write-Host "Failed to register Gitea repository"
|
||||
Write-Host $_.Exception.Message
|
||||
}
|
||||
finally {
|
||||
Write-Host "Gitea repository registered"
|
||||
}
|
||||
|
||||
- name: Install DotNet
|
||||
run: |
|
||||
echo "Installing DotNet"
|
||||
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel LTS --install-dir /usr/share/dotnet
|
||||
echo Adding DotNet to PATH
|
||||
export DOTNET_ROOT=/usr/share/dotnet
|
||||
export PATH=$PATH:/usr/share/dotnet
|
||||
|
||||
- name: Publish module to Gitea
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "Adding DotNet to PATH"
|
||||
$env:DOTNET_ROOT = '/usr/share/dotnet'
|
||||
$env:PATH = $env:PATH + ':/usr/share/dotnet'
|
||||
Write-Host "Changing to repository directory: ${{ github.workspace }}"
|
||||
Set-Location -Path ${{ github.workspace }}
|
||||
$moduleVersion = git describe --tags
|
||||
Write-Host "Module version: $moduleVersion"
|
||||
$module = get-childItem -path . -Directory -Exclude ".*" | Select-Object -ExpandProperty Name
|
||||
Write-Host "Publishing module $module to Gitea"
|
||||
Publish-Module -Path $module -Repository 'GiteaPrivate' -NuGetApiKey "${{ secrets.PACKAGES_TOKEN }}"
|
||||
Write-Host "Module $module published to Gitea"
|
||||
|
||||
- name: Create draft release
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
with:
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
release_name: Release ${{ github.ref_name }}
|
||||
body: |
|
||||
This release includes the nuget package for the ${{ github.ref_name }} version of the module.
|
||||
draft: true
|
||||
prerelease: ${{ contains(github.ref_name, 'rc') }}
|
||||
|
||||
- name: Upload release asset
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
with:
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
release_name: Release ${{ github.ref_name }}
|
||||
file: ${{ github.workspace }}/*.nupkg
|
||||
draft: true
|
||||
prerelease: ${{ contains(github.ref_name, 'rc') }}
|
||||
|
||||
- name: Publish release
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
with:
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
release_name: Release ${{ github.ref_name }}
|
||||
draft: false
|
||||
prerelease: ${{ contains(github.ref_name, 'rc') }}
|
||||
Reference in New Issue
Block a user