Skip to content

Commit

Permalink
Create release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Carpenteri1 authored Nov 16, 2024
1 parent 52d2933 commit c1b3a3d
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
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 }}

0 comments on commit c1b3a3d

Please sign in to comment.