Skip to content

Update actions

Update actions #3

Workflow file for this run

name: Release
on:
push:
branches:
- main
pull_request:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed to analyze commit history
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm install conventional-changelog-cli
- name: Generate changelog
id: changelog
run: |
echo "🔍 Generating changelog..."
CHANGELOG=$(./node_modules/.bin/conventional-changelog -p angular -i changelog.tmp.txt -s)
echo "✅ Changelog generated."
echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT
- name: Extract version from changelog
id: extract_version
run: |
VERSION=$(echo "${{ steps.changelog.outputs.changelog }}" | grep -oP '## \d+\.\d+\.\d+' | head -n 1 | grep -oP '\d+\.\d+\.\d+')
echo "✅ Extracted version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create Git tag
if: github.ref == 'refs/heads/main'
run: git tag -a "v${{ steps.extract_version.outputs.version }}" -m "Release v${{ steps.extract_version.outputs.version }}"
- name: Package mod
if: github.ref == 'refs/heads/main'
run: zip -r creative-mod.zip . -x "*.git*" -x ".github/*"
- name: Create GitHub Release
id: create_release
if: github.ref == 'refs/heads/main'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.extract_version.outputs.version }}
release_name: Release v${{ steps.extract_version.outputs.version }}
body_path: changelog.txt
draft: false
prerelease: false
- name: Upload Release Asset
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: creative-mod.zip
asset_name: creative-mod.zip
asset_content_type: application/zip