Release new version #31
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
name: Release new version | |
on: | |
workflow_dispatch: | |
inputs: | |
major-release: | |
required: false | |
description: 'Trigger a major release (optional). Leave empty for regular release.' | |
jobs: | |
integration-tests: | |
uses: ./.github/workflows/integration-tests.yml | |
secrets: inherit | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: integration-tests | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.RELEASE_PAT }} | |
- name: Setup git config | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
shell: bash | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install argparse build semver twine | |
shell: bash | |
- name: Checkout release action repo | |
uses: actions/checkout@v2 | |
with: | |
repository: firebolt-db/action-python-release | |
path: release_action | |
- name: Generate new version tag | |
id: tag_generation | |
run: | | |
OLD_VERSION=$(git describe --tags --abbrev=0) | |
echo "Old version was ${OLD_VERSION}" | |
CHANGE_LOG=$(git log $OLD_TAG..HEAD --pretty=format:%s) | |
NEW_VERSION=$(python3 release_action/scripts/generate_version_tag.py "${CHANGE_LOG}" $OLD_VERSION --major_release "${{ inputs.major-release }}") | |
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Version bump | |
run: | | |
sed -i "s/^ <FileVersion>.*<\/FileVersion>/ <FileVersion>${{ steps.tag_generation.outputs.new_version }}<\/FileVersion>/" FireboltNETSDK/FireboltDotNetSdk.csproj | |
sed -i "s/^ <AssemblyVersion>.*<\/AssemblyVersion>/ <AssemblyVersion>${{ steps.tag_generation.outputs.new_version }}<\/AssemblyVersion>/" FireboltNETSDK/FireboltDotNetSdk.csproj | |
sed -i "s/^ <Version>.*<\/Version>/ <Version>${{ steps.tag_generation.outputs.new_version }}<\/Version>/" FireboltNETSDK/FireboltDotNetSdk.csproj | |
git branch | |
git diff | |
git add FireboltNETSDK/FireboltDotNetSdk.csproj | |
git commit -m "Automatic version bump to ${{ steps.tag_generation.outputs.new_version }}" | |
git push origin main | |
shell: bash | |
- name: Publish tag on github | |
run: | | |
git tag ${{ steps.tag_generation.outputs.new_version }} | |
git push origin ${{ steps.tag_generation.outputs.new_version }} | |
shell: bash | |
- name: Set up .NET 6.0 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0 | |
- name: Build package | |
run: | | |
dotnet restore | |
dotnet build | |
dotnet pack | |
shell: bash | |
- name: Publish package on Nuget | |
run: | | |
dotnet nuget push FireboltNETSDK/bin/Debug/FireboltNetSDK.${{ steps.tag_generation.outputs.new_version }}.nupkg \ | |
--api-key ${{ secrets.PUBLISH_API_KEY }} \ | |
--source https://api.nuget.org/v3/index.json | |
shell: bash |