Skip to content

Commit

Permalink
Merge pull request #1210 from KelvinTegelaar/interface-rewrite
Browse files Browse the repository at this point in the history
Interface rewrite to dev
  • Loading branch information
JohnDuprey authored Jan 10, 2025
2 parents a6627bb + 6edfd03 commit 1edeca1
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 7 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Generate Release Notes and Upload Production to Azure

on:
push:
branches:
- master

permissions:
contents: write

jobs:
release:
if: github.event.repository.fork == false && github.event_name == 'push'
name: Generate Release Notes and Upload to Azure
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v3

# Read and Trim Version
- name: Read and Trim Version
id: get_version
run: |
if [ ! -f version_latest.txt ]; then
echo "Error: version_latest.txt not found!"
exit 1
fi
VERSION=$(cat version_latest.txt | tr -d '[:space:]')
if [ -z "$VERSION" ]; then
echo "Error: version_latest.txt is empty after trimming!"
exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
# Exit if Tag Already Exists
- name: Check if Tag Exists
id: tag_check
run: |
git fetch --tags
if git rev-parse "refs/tags/${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
echo "tag_exists=true" >> $GITHUB_ENV
echo "Tag ${{ steps.get_version.outputs.version }} already exists. Exiting workflow successfully."
else
echo "tag_exists=false" >> $GITHUB_ENV
fi
# Generate Release Notes
- name: Generate Release Notes
id: changelog
if: env.tag_exists == 'false'
uses: mikepenz/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Create a new release tag
- name: Create GitHub Release
if: env.tag_exists == 'false'
uses: ncipollo/[email protected]
with:
tag: ${{ steps.get_version.outputs.version }}
name: "v${{ steps.get_version.outputs.version }}"
draft: false
prerelease: false
makeLatest: true
body: ${{ steps.changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Create ZIP File in a New Source Directory
- name: Prepare and Zip Release Files
if: env.tag_exists == 'false'
run: |
mkdir -p src/releases
zip -r src/releases/release_${{ steps.get_version.outputs.version }}.zip . \
--exclude "./src/releases/*" \
--exclude ".*" \
--exclude ".*/**"
zip -r src/releases/latest.zip . \
--exclude "./src/releases/*" \
--exclude ".*" \
--exclude ".*/**"
# Upload to Azure Blob Storage
- name: Azure Blob Upload with Destination folder defined
if: env.tag_exists == 'false'
uses: LanceMcCarthy/[email protected]
with:
connection_string: ${{ secrets.AZURE_CONNECTION_STRING }}
container_name: cipp-api
source_folder: src/releases/
destination_folder: /
delete_if_exists: true
3 changes: 1 addition & 2 deletions Modules/CIPPCore/Public/Assert-CippVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ function Assert-CippVersion {
$APIVersion = (Get-Content 'version_latest.txt' -Raw).trim()

$RemoteAPIVersion = (Invoke-RestMethod -Uri 'https://raw.githubusercontent.com/KelvinTegelaar/CIPP-API/master/version_latest.txt').trim()
$RemoteCIPPVersion = (Invoke-RestMethod -Uri 'https://raw.githubusercontent.com/KelvinTegelaar/CIPP/main/public/version_latest.txt').trim()

$RemoteCIPPVersion = (Invoke-RestMethod -Uri 'https://raw.githubusercontent.com/KelvinTegelaar/CIPP/main/public/version.json').version

[PSCustomObject]@{
LocalCIPPVersion = $CIPPVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ function Invoke-ListGraphRequest {

$Parameters = @{}
if ($Request.Query.'$filter') {
$Parameters.'$filter' = $Request.Query.'$filter' -replace '%tenantid%', $env:TenantId
$Parameters.'$filter' = $Request.Query.'$filter' -replace '%tenantid%', $env:TenantID
}

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

if ($Request.Query.'$select') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Function Invoke-ExecCPVPermissions {
}

$GraphRequest = try {
if ($TenantFilter -notin @('PartnerTenant', $env:TenantId)) {
if ($TenantFilter -notin @('PartnerTenant', $env:TenantID)) {
Set-CIPPCPVConsent @CPVConsentParams
} else {
$TenantFilter = $env:TenantID
Expand All @@ -40,7 +40,7 @@ Function Invoke-ExecCPVPermissions {
}
Add-CIPPApplicationPermission -RequiredResourceAccess 'CIPPDefaults' -ApplicationId $ENV:ApplicationID -tenantfilter $TenantFilter
Add-CIPPDelegatedPermission -RequiredResourceAccess 'CIPPDefaults' -ApplicationId $ENV:ApplicationID -tenantfilter $TenantFilter
if ($TenantFilter -notin @('PartnerTenant', $env:TenantId)) {
if ($TenantFilter -notin @('PartnerTenant', $env:TenantID)) {
Set-CIPPSAMAdminRoles -TenantFilter $TenantFilter
}
$Success = $true
Expand Down
2 changes: 1 addition & 1 deletion Modules/CippExtensions/Public/HIBP/Get-HIBPAuth.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Get-HIBPAuth {
}

return @{
'User-Agent' = "CIPP-$($ENV:TenantId)"
'User-Agent' = "CIPP-$($ENV:TenantID)"
'Accept' = 'application/json'
'api-version' = '3'
'hibp-api-key' = $Secret
Expand Down

0 comments on commit 1edeca1

Please sign in to comment.