-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edit pipeline for Nightly Releases (#208)
* Edit pipeline for Nightly Releases * Create changelog * Fuck it, we script it * I swear if that's the reason why it fails... * I want to cry * Hope is slipping away * I am loosing my mind * I GOT IT ! * Quick polishing
- Loading branch information
Showing
1 changed file
with
85 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ on: | |
workflow_dispatch: # ReleaseGen can be triggered manually | ||
|
||
env: | ||
IS_TAG: ${{ github.ref_type == 'tag' }} | ||
IS_RELEASE: ${{ github.ref_type == 'tag' }} | ||
ZIP_NAME: ${{ github.ref_type == 'tag' && 'Release_' || 'Release_Nightly_' }} | ||
ZIP_PATH: ${{ github.ref_type == 'tag' && 'FASTER_' || 'FASTER_Nightly_' }} | ||
|
||
|
@@ -72,51 +72,103 @@ jobs: | |
env: | ||
Runtime: ${{ matrix.runtime }} | ||
|
||
# Zip the folder | ||
# Zip the folder | ||
- name: Zip the application folder | ||
run: Compress-Archive -Path .\$env:ZIP_NAME$env:Runtime\* -DestinationPath .\$env:ZIP_NAME$env:Runtime.zip | ||
shell: pwsh | ||
env: | ||
Runtime: ${{ matrix.runtime }} | ||
|
||
# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact | ||
# - name: Upload build artifacts | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: Release_Nightly_${{ env.Runtime }} | ||
# path: .\FASTER_Nightly_${{ env.Runtime }} | ||
# env: | ||
# Runtime: ${{ matrix.runtime }} | ||
|
||
# Get version number | ||
- name: get-net-sdk-project-versions-action | ||
uses: kzrnm/[email protected] | ||
id: get-version | ||
with: | ||
proj-path: ./FASTER/FASTER.csproj | ||
|
||
# Get Changes between Tags | ||
- name: Generate Changelog | ||
id: get-changes | ||
run: | | ||
Write-Output "::group::Collecting Changes between Tags..." | ||
# Set options from inputs | ||
$tagPattern = "^v?\d\.\d+([a-zA-Z]|\.\d+([a-zA-Z])?)?" | ||
$linePrefix = "- " | ||
# Fetch all tags from origin | ||
git fetch origin --tags --force | ||
# Get tags that match the pattern and sort them using version sorting in reverse | ||
$tags = git tag --sort=committerdate -l | Select-String -Pattern $tagPattern | Sort-Object -Descending || "" | ||
# Count the found tags | ||
$countTags = ($tags -split "`n").Count | ||
# Exit with error if no tags are found | ||
if ($tags -eq "" -or $countTags -le 0) { | ||
Write-Output "::error title=no tags found::changes-between-tags action could not find any tags to work with" | ||
exit 1 | ||
} | ||
# Take the first tag as latestTag | ||
$latestTag = ($tags -split "`n")[0] | ||
$range = "$latestTag" + "..@" | ||
# Get changes for range | ||
$changes = git log --pretty=reference --no-decorate $range | ||
# If set, add a prefix to every commit message | ||
if ($linePrefix) { | ||
$changes = $changes -replace "^(.*)$", "$linePrefix`$1" | ||
} | ||
# Set outputs | ||
$EOF = (New-Guid).Guid | ||
"changes<<$EOF" >> $env:GITHUB_OUTPUT | ||
$changes >> $env:GITHUB_OUTPUT | ||
"$EOF" >> $env:GITHUB_OUTPUT | ||
"tag=$latestTag" >> $env:GITHUB_OUTPUT | ||
# Log the results | ||
Write-Output "tag: $latestTag" | ||
Write-Output "changes:" | ||
Write-Output $changes | ||
# End log grouping | ||
Write-Output "::endgroup::" | ||
shell: pwsh | ||
|
||
# Set Version Number to environment | ||
- name: Set Version | ||
id: set_version | ||
run: | | ||
if ($env:IS_TAG -eq "true") { | ||
if ($env:IS_RELEASE -eq "true") { | ||
echo "VERSION=$env:GITHUB_REF" >> $env:GITHUB_ENV | ||
} else { | ||
echo "VERSION=${{ steps.get-version.outputs.version }}" >> $env:GITHUB_ENV | ||
} | ||
shell: pwsh | ||
|
||
#Create Release | ||
- name: Create Release | ||
if: env.IS_RELEASE == 'true' | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: v${{ env.VERSION }} | ||
release_name: ${{ env.IS_TAG == 'true' && 'Release' || 'PreRelease' }} ${{ env.VERSION }} | ||
tag_name: 'v${{ env.VERSION }}' | ||
release_name: 'Release v${{ env.VERSION }}' | ||
body: ${{ steps.get-changes.outputs.changes }} | ||
draft: false | ||
prerelease: ${{ env.IS_TAG == 'false' }} | ||
prerelease: ${{ env.IS_RELEASE == 'false' }} | ||
|
||
#Upload Artifacts | ||
# Upload Artifacts | ||
- name: Upload Release Asset | ||
if: env.IS_RELEASE == 'true' | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
|
@@ -127,4 +179,20 @@ jobs: | |
asset_path: .\${{ env.ZIP_NAME}}${{ env.Runtime }}.zip | ||
asset_name: ${{ env.ZIP_NAME}}${{ env.Runtime }}.zip | ||
asset_content_type: application/zip | ||
|
||
|
||
# Create Nightly Release | ||
- name: Create Nightly Release | ||
uses: andelf/nightly-release@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
Runtime: ${{ matrix.runtime }} | ||
with: | ||
tag_name: nightly | ||
name: 'Nightly Release v${{ env.VERSION }}' | ||
body: | | ||
Changelog since release ${{ steps.get-changes.outputs.tag }} : | ||
--- | ||
${{ steps.get-changes.outputs.changes }} | ||
--- | ||
prerelease: true | ||
files: .\${{ env.ZIP_NAME}}${{ env.Runtime }}.zip |