Skip to content

.github/workflows/CreateRelease.yml #73

.github/workflows/CreateRelease.yml

.github/workflows/CreateRelease.yml #73

Workflow file for this run

on:
push:
paths:
- 'FunctionApp/**'
- 'deploy/**'
- 'StandardSessionHostTemplate/**'
workflow_dispatch:
inputs:
messages:
description: 'Why are you running manually?'
required: false
default: 'Manual Run'
jobs:
Build-Nightly-Zip:
runs-on: ubuntu-latest
#if: github.sha == github.event.head_commit.id # Only run the job if the commit is the latest one
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/[email protected]
with:
ref: ${{ github.head_ref}}
- name: Set PRERELEASE based on branch name
id: set_prerelease
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "PRERELEASE=false" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == refs/heads/Dev* ]]; then
echo "PRERELEASE=true" >> $GITHUB_ENV
else
echo "PRERELEASE=true" >> $GITHUB_ENV
fi
- name: Generate New Version and Tag (Dry_Run)
id: bump_version_DryRun
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: patch # Default to patch if no keywords are found
WITH_V: true # Prefix the tag with 'v'
PRERELEASE: ${{ env.PRERELEASE }} # Set PRERELEASE based on the branch name
VERBOSE: true
DRY_RUN: true
- name: Run-Build-Script
shell: pwsh
run: |
./Build/Build-Zip-File.ps1 -Path ".\temp" -Tag "${{ steps.bump_version_DryRun.outputs.new_tag }}"
# Commit changes made by the build script if any. This includes the newly created zip file or any other changes
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Automated commit by GitHub Actions for new build [no ci]" || echo "No changes to commit"
git push
- name: Bump version and push tag
id: bump_version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: patch # Default to patch if no keywords are found
WITH_V: true # Prefix the tag with 'v'
PRERELEASE: ${{ env.PRERELEASE }} # Set PRERELEASE based on the branch name
VERBOSE: true
- name: Run-Build-Script
id: ReleaseBody
shell: pwsh
run: |
./Build/Build-Release-Body.ps1 -Tag "${{ steps.bump_version.outputs.new_tag }}" -GitRef "${{ github.ref_name }}"
- name: Create Release
# You may pin to the exact commit or the version.
# uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
uses: ncipollo/[email protected]
with:
# An optional flag which indicates if we should update a release if it already exists. Defaults to false.
allowUpdates: true # optional, default is
# An optional flag which indicates if artifact read or upload errors should fail the build.
artifactErrorsFailBuild: true # optional, default is
# An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma delimited list of paths (or globs)
artifacts: ./temp/FunctionApp.zip # optional
# The content type of the artifact. Defaults to raw
# generateReleaseNotes: true # optional, default is false
# Indicates if the release should be the "latest" release or not.
prerelease: ${{ env.PRERELEASE }} # Set PRERELEASE based on the branch name
replacesArtifacts: true # optional, default is true
# Optionally specify the repo where the release should be generated. Defaults to current repo
tag: ${{ steps.bump_version.outputs.new_tag }} # optional, default is
# The Github token.
token: ${{ secrets.GITHUB_TOKEN }} # optional, default is ${{ github.token }}
body: ${{ steps.ReleaseBody.outputs.ReleaseBody }}