Skip to content

Commit 6243939

Browse files
Fix broken publishing (#24)
# Pull Request ## Description Changing the release process and pipelines to support a workflow where we can publish changes to an alpha channel for testing. Proper releases are a manual workflow to support a decision to take a release 'live'. GitHub releases now used as a features. ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
1 parent e893692 commit 6243939

File tree

9 files changed

+223
-101
lines changed

9 files changed

+223
-101
lines changed

.github/prerelease-drafter.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name-template: '$NEXT_PATCH_VERSION-alpha'
2+
tag-template: '$NEXT_PATCH_VERSION-alpha'
3+
prerelease: true
4+
categories:
5+
- title: '🚀 Features'
6+
labels:
7+
- 'feature'
8+
- 'enhancement'
9+
- title: '🐛 Bug Fixes'
10+
labels:
11+
- 'fix'
12+
- 'bugfix'
13+
- 'bug'
14+
- title: '🧰 Maintenance'
15+
label: 'chore'
16+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
17+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
18+
version-resolver:
19+
major:
20+
labels:
21+
- 'major'
22+
minor:
23+
labels:
24+
- 'minor'
25+
patch:
26+
labels:
27+
- 'patch'
28+
default: patch
29+
template: |
30+
## Changes
31+
32+
$CHANGES

.github/release-drafter.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name-template: '$RESOLVED_VERSION'
2+
tag-template: '$RESOLVED_VERSION'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: '🐛 Bug Fixes'
9+
labels:
10+
- 'fix'
11+
- 'bugfix'
12+
- 'bug'
13+
- title: '🧰 Maintenance'
14+
label: 'chore'
15+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
16+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
17+
version-resolver:
18+
major:
19+
labels:
20+
- 'major'
21+
minor:
22+
labels:
23+
- 'minor'
24+
patch:
25+
labels:
26+
- 'patch'
27+
default: patch
28+
template: |
29+
## Changes
30+
31+
$CHANGES

.github/workflows/MainBuild.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

.github/workflows/Prerelease.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Prerelease Drafter
2+
3+
on:
4+
push:
5+
# branches to consider in the event; optional, defaults to all
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
update_release_draft:
14+
permissions:
15+
# write permission is required to create a github release
16+
contents: write
17+
# write permission is required for autolabeler
18+
# otherwise, read permission is required at least
19+
pull-requests: write
20+
runs-on: ubuntu-latest
21+
steps:
22+
# Drafts your next Release notes as Pull Requests are merged into "master"
23+
- name: Check out repository
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 0
27+
- name: Display the path
28+
shell: pwsh
29+
run: echo ${env:PATH}
30+
- name: Version Display
31+
shell: pwsh
32+
run: $PSVersionTable
33+
- name: Bootstrap
34+
shell: pwsh
35+
run: ./actions_bootstrap.ps1
36+
- name: Test and Build
37+
shell: pwsh
38+
run: Invoke-Build -File .\src\ALZ.build.ps1
39+
- name: Upload pester results
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: pester-results
43+
path: .\src\Artifacts\testOutput
44+
if-no-files-found: warn
45+
- name: Upload zip module archive build
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: zip-archive
49+
path: .\src\Archive
50+
if-no-files-found: warn
51+
- uses: release-drafter/release-drafter@v5
52+
id: create_release
53+
with:
54+
config-name: prerelease-drafter.yml
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
- name: Package ALZ Module
58+
shell: pwsh
59+
run: |
60+
$tag_version = "${{ steps.create_release.outputs.tag_name }}".Replace("-alpha", "")
61+
./package_ALZ.ps1 -version $tag_version -prerelease alpha
62+
- uses: montudor/action-zip@v1
63+
with:
64+
args: zip -qq -r ALZ.zip ALZ
65+
- uses: actions/upload-release-asset@v1.0.1
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
with:
69+
upload_url: ${{ steps.create_release.outputs.upload_url }}
70+
asset_path: ./ALZ.zip
71+
asset_name: ALZ.zip
72+
asset_content_type: application/zip
73+
- uses: eregon/publish-release@v1
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
with:
77+
release_id: ${{ steps.create_release.outputs.id }}
78+
- name: Publish ALZ Module
79+
shell: pwsh
80+
run: |
81+
Publish-Module -Path "./ALZ" -NuGetApiKey ${{ secrets.POWERSHELL_GALLERY_KEY }}

.github/workflows/PullRequest.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,6 @@ jobs:
1818
uses: actions/checkout@v3
1919
with:
2020
fetch-depth: 0
21-
- uses: actions/setup-dotnet@v3
22-
with:
23-
dotnet-version: '3.1.x'
24-
- name: Install GitVersion
25-
uses: gittools/actions/gitversion/setup@v0
26-
with:
27-
versionSpec: '5.5.0'
28-
- name: Determine Version
29-
id: gitversion # id to later be referenced
30-
uses: gittools/actions/gitversion/execute@v0
31-
with:
32-
useConfigFile: true
3321
- name: Display the path
3422
shell: pwsh
3523
run: echo ${env:PATH}
@@ -47,17 +35,4 @@ jobs:
4735
with:
4836
name: pester-results
4937
path: .\src\Artifacts\testOutput
50-
if-no-files-found: warn
51-
- name: Upload zip module archive build
52-
uses: actions/upload-artifact@v3
53-
with:
54-
name: zip-archive
55-
path: .\src\Archive
56-
if-no-files-found: warn
57-
- name: Package ALZ Module
58-
shell: pwsh
59-
run: ./package_ALZ.ps1 -version ${{ steps.gitversion.outputs.majorMinorPatch }} -prerelease ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}
60-
- name: Publish ALZ Module
61-
shell: pwsh
62-
run: |
63-
Publish-Module -Path "./ALZ" -NuGetApiKey ${{ secrets.POWERSHELL_GALLERY_KEY }} -Force
38+
if-no-files-found: warn

.github/workflows/Release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Prerelease Drafter
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
update_release_draft:
11+
permissions:
12+
# write permission is required to create a github release
13+
contents: write
14+
# write permission is required for autolabeler
15+
# otherwise, read permission is required at least
16+
pull-requests: write
17+
runs-on: ubuntu-latest
18+
steps:
19+
# Drafts your next Release notes as Pull Requests are merged into "master"
20+
- name: Check out repository
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
- name: Display the path
25+
shell: pwsh
26+
run: echo ${env:PATH}
27+
- name: Version Display
28+
shell: pwsh
29+
run: $PSVersionTable
30+
- name: Bootstrap
31+
shell: pwsh
32+
run: ./actions_bootstrap.ps1
33+
- name: Test and Build
34+
shell: pwsh
35+
run: Invoke-Build -File .\src\ALZ.build.ps1
36+
- name: Upload pester results
37+
uses: actions/upload-artifact@v3
38+
with:
39+
name: pester-results
40+
path: .\src\Artifacts\testOutput
41+
if-no-files-found: warn
42+
- name: Upload zip module archive build
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: zip-archive
46+
path: .\src\Archive
47+
if-no-files-found: warn
48+
- uses: release-drafter/release-drafter@v5
49+
id: create_release
50+
with:
51+
config-name: prerelease-drafter.yml
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
- name: Package ALZ Module
55+
shell: pwsh
56+
run: |
57+
./package_ALZ.ps1 -version ${{ steps.create_release.outputs.tag_name }}
58+
- uses: montudor/action-zip@v1
59+
with:
60+
args: zip -qq -r ALZ.zip ALZ
61+
- uses: actions/upload-release-asset@v1.0.1
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
upload_url: ${{ steps.create_release.outputs.upload_url }}
66+
asset_path: ./ALZ.zip
67+
asset_name: ALZ.zip
68+
asset_content_type: application/zip
69+
- uses: eregon/publish-release@v1
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
with:
73+
release_id: ${{ steps.create_release.outputs.id }}
74+
- name: Publish ALZ Module
75+
shell: pwsh
76+
run: |
77+
Publish-Module -Path "./ALZ" -NuGetApiKey ${{ secrets.POWERSHELL_GALLERY_KEY }}

GitVersion.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# ALZ
22

3-
[![ActionsTest-Windows-pwsh-Build](https://github.com/Azure/ALZ-PowerShell-Module/actions/workflows/wf_Windows_Core.yml/badge.svg?branch=main)](https://github.com/Azure/ALZ-PowerShell-Module/actions/workflows/wf_Windows_Core.yml)
43
[![license](https://img.shields.io/badge/License-MIT-purple.svg)](LICENSE)
54

65
![Logo](./docs/ALZLogo.png)

package_ALZ.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ New-Item "ALZ" -ItemType Directory -Force
77
Copy-Item -Path "./src/Artifacts/*" -Destination "./ALZ" -Recurse -Exclude "ccReport", "testOutput" -Force
88

99
Update-ModuleManifest -Path "./ALZ/ALZ.psd1" -ModuleVersion $version -Prerelease $prerelease
10+

0 commit comments

Comments
 (0)