Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This addresses two issues with our releases #119

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions .github/workflows/create-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,45 @@ jobs:

# Publish the build artifacts
- name: Publish
run: dotnet publish --configuration Release --output ./publish
run: dotnet publish --no-build --configuration Release --output ./publish

# Run EF migrations
- name: Run EF migrations
run: dotnet ef migrations script --project src/Migrators/Migrators.MSSQL/Migrators.MSSQL.csproj --startup-project src/Server.UI/Server.UI.csproj --context Cfo.Cats.Infrastructure.Persistence.ApplicationDbContext --idempotent -o ./publish/Migration.sql
run: dotnet ef migrations script --no-build --project src/Migrators/Migrators.MSSQL/Migrators.MSSQL.csproj --startup-project src/Server.UI/Server.UI.csproj --context Cfo.Cats.Infrastructure.Persistence.ApplicationDbContext --idempotent -o ./publish/Migration.sql

# Compress the build artifacts into a ZIP file
- name: Compress build artifacts
run: |
cd publish
zip -r ../build-artifacts.zip .

# Generate tag and release names based on date
# Read and increment version number
- name: Increment Version
id: increment_version
run: |
# Read the current version from the GitHub secret
CURRENT_VERSION=${{ secrets.INITIAL_VERSION }}

# Split the version into major, minor, and patch
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}

# Increment the patch version
PATCH=$((PATCH + 1))

# Form the new version
NEW_VERSION="$MAJOR.$MINOR.$PATCH"

# Set the new version as an environment variable
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV

# Generate tag and release names based on the new version
- name: Set Release Version
id: set_release_version
run: |
TAG_NAME="v$(date +'%Y%m%d%H%M%S')"
TAG_NAME="v${{ env.NEW_VERSION }}"
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "RELEASE_NAME=Release $TAG_NAME" >> $GITHUB_ENV

Expand All @@ -73,7 +95,7 @@ jobs:
with:
tag_name: ${{ env.TAG_NAME }}
release_name: ${{ env.RELEASE_NAME }}
body: 'Automatic release based on date and time.'
body: 'Automatic release with incremented version number.'
draft: false
prerelease: false

Expand Down
Loading