Skip to content

Commit e44881d

Browse files
authored
Merge pull request #1209 from KelvinTegelaar/interface-rewrite
add release workflow, tenantid fix
2 parents ad595b6 + 1db622d commit e44881d

File tree

4 files changed

+98
-5
lines changed

4 files changed

+98
-5
lines changed

.github/workflows/publish_release.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Generate Release Notes and Upload Production to Azure
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
if: github.event.repository.fork == false && github.event_name == 'push'
14+
name: Generate Release Notes and Upload to Azure
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
# Checkout the repository
19+
- name: Checkout Code
20+
uses: actions/checkout@v3
21+
22+
# Read and Trim Version
23+
- name: Read and Trim Version
24+
id: get_version
25+
run: |
26+
if [ ! -f version_latest.txt ]; then
27+
echo "Error: version_latest.txt not found!"
28+
exit 1
29+
fi
30+
VERSION=$(cat version_latest.txt | tr -d '[:space:]')
31+
if [ -z "$VERSION" ]; then
32+
echo "Error: version_latest.txt is empty after trimming!"
33+
exit 1
34+
fi
35+
echo "version=$VERSION" >> $GITHUB_OUTPUT
36+
37+
# Exit if Tag Already Exists
38+
- name: Check if Tag Exists
39+
id: tag_check
40+
run: |
41+
git fetch --tags
42+
if git rev-parse "refs/tags/${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
43+
echo "tag_exists=true" >> $GITHUB_ENV
44+
echo "Tag ${{ steps.get_version.outputs.version }} already exists. Exiting workflow successfully."
45+
else
46+
echo "tag_exists=false" >> $GITHUB_ENV
47+
fi
48+
49+
# Generate Release Notes
50+
- name: Generate Release Notes
51+
id: changelog
52+
if: env.tag_exists == 'false'
53+
uses: mikepenz/[email protected]
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
57+
# Create a new release tag
58+
- name: Create GitHub Release
59+
if: env.tag_exists == 'false'
60+
uses: ncipollo/[email protected]
61+
with:
62+
tag: ${{ steps.get_version.outputs.version }}
63+
name: "v${{ steps.get_version.outputs.version }}"
64+
draft: false
65+
prerelease: true
66+
body: ${{ steps.changelog.outputs.changelog }}
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
70+
# Create ZIP File in a New Source Directory
71+
- name: Prepare and Zip Release Files
72+
if: env.tag_exists == 'false'
73+
run: |
74+
mkdir -p src/releases
75+
zip -r src/releases/release_${{ steps.get_version.outputs.version }}.zip . \
76+
--exclude "./src/releases/*" \
77+
--exclude ".*" \
78+
--exclude ".*/**"
79+
zip -r src/releases/latest.zip . \
80+
--exclude "./src/releases/*" \
81+
--exclude ".*" \
82+
--exclude ".*/**"
83+
84+
# Upload to Azure Blob Storage
85+
- name: Azure Blob Upload with Destination folder defined
86+
if: env.tag_exists == 'false'
87+
uses: LanceMcCarthy/[email protected]
88+
with:
89+
connection_string: ${{ secrets.AZURE_CONNECTION_STRING }}
90+
container_name: cipp-api
91+
source_folder: src/releases/
92+
destination_folder: /
93+
delete_if_exists: true

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListGraphRequest.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ function Invoke-ListGraphRequest {
1818

1919
$Parameters = @{}
2020
if ($Request.Query.'$filter') {
21-
$Parameters.'$filter' = $Request.Query.'$filter' -replace '%tenantid%', $env:TenantId
21+
$Parameters.'$filter' = $Request.Query.'$filter' -replace '%tenantid%', $env:TenantID
2222
}
2323

2424
if (!$Request.Query.'$filter' -and $Request.Query.graphFilter) {
25-
$Parameters.'$filter' = $Request.Query.graphFilter -replace '%tenantid%', $env:TenantId
25+
$Parameters.'$filter' = $Request.Query.graphFilter -replace '%tenantid%', $env:TenantID
2626
}
2727

2828
if ($Request.Query.'$select') {

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecCPVPermissions.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Function Invoke-ExecCPVPermissions {
2929
}
3030

3131
$GraphRequest = try {
32-
if ($TenantFilter -notin @('PartnerTenant', $env:TenantId)) {
32+
if ($TenantFilter -notin @('PartnerTenant', $env:TenantID)) {
3333
Set-CIPPCPVConsent @CPVConsentParams
3434
} else {
3535
$TenantFilter = $env:TenantID
@@ -40,7 +40,7 @@ Function Invoke-ExecCPVPermissions {
4040
}
4141
Add-CIPPApplicationPermission -RequiredResourceAccess 'CIPPDefaults' -ApplicationId $ENV:ApplicationID -tenantfilter $TenantFilter
4242
Add-CIPPDelegatedPermission -RequiredResourceAccess 'CIPPDefaults' -ApplicationId $ENV:ApplicationID -tenantfilter $TenantFilter
43-
if ($TenantFilter -notin @('PartnerTenant', $env:TenantId)) {
43+
if ($TenantFilter -notin @('PartnerTenant', $env:TenantID)) {
4444
Set-CIPPSAMAdminRoles -TenantFilter $TenantFilter
4545
}
4646
$Success = $true

Modules/CippExtensions/Public/HIBP/Get-HIBPAuth.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function Get-HIBPAuth {
99
}
1010

1111
return @{
12-
'User-Agent' = "CIPP-$($ENV:TenantId)"
12+
'User-Agent' = "CIPP-$($ENV:TenantID)"
1313
'Accept' = 'application/json'
1414
'api-version' = '3'
1515
'hibp-api-key' = $Secret

0 commit comments

Comments
 (0)