-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52d2933
commit c1b3a3d
Showing
1 changed file
with
61 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Angular Release Workflow | ||
|
||
on: | ||
workflow_dispatch: # This allows manual triggering from the GitHub UI | ||
inputs: | ||
version: | ||
description: 'Enter the version number (e.g., 1.2.0)' | ||
required: false | ||
default: 'auto' # Default version if user doesn't input anything | ||
|
||
jobs: | ||
build_and_release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
- name: Get current version from package.json | ||
id: get_version | ||
run: | | ||
VERSION=$(jq -r .version package.json) | ||
echo "Current version is $VERSION" | ||
echo "CURRENT_VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Ask for version if not provided | ||
id: ask_version | ||
run: | | ||
if [ "${{ github.event.inputs.version }}" != "auto" ]; then | ||
echo "Using provided version: ${{ github.event.inputs.version }}" | ||
echo "NEW_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV | ||
else | ||
NEW_VERSION=$(npm version patch -m "Release version %s") | ||
echo "Auto versioning: new version is $NEW_VERSION" | ||
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | ||
fi | ||
- name: Build Angular project | ||
run: | | ||
ng build --prod --configuration=production | ||
- name: Create Git tag with new version | ||
run: | | ||
git tag $NEW_VERSION | ||
git push origin $NEW_VERSION | ||
- name: Upload production build to GitHub Releases | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: ./dist/{your-project-name}/**/* # Adjust this path to match your dist folder | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |