Skip to content

Update releases.yml

Update releases.yml #1

Workflow file for this run

name: Release Workflow
on:
push:
branches:
- main # Trigger the workflow on pushes to the 'main' branch
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Set up Node.js (or your project's language/runtime)
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16' # Modify according to your version
# Install dependencies
- name: Install dependencies
run: npm install
# Run tests (optional, but recommended)
- name: Run tests
run: npm test
# Build the project (if applicable)
- name: Build project
run: npm run build
release:
runs-on: ubuntu-latest
needs: build
steps:
# Checkout the code again
- name: Checkout code
uses: actions/checkout@v3
# Determine the version
- name: Get Version
id: version
run: |
VERSION=$(date +'%Y.%m.%d.%H%M%S') # Use a timestamp for unique versioning
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "::set-output name=version::$VERSION"
# Create a GitHub release
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: |
Changes in this release:
- Code pushed to the main branch.
draft: false # Set to true if you want a draft release
prerelease: false # Set to true if this is a prerelease