Skip to content

Create Release

Create Release #12

# Creates a release from a tagged commit
name: Create Release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set RELEASE_VERSION
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Test RELEASE_VERSION
run: |
echo $RELEASE_VERSION
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://npm.pkg.github.com"
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run build
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release and Upload Asset
id: upload-release-asset
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: $RELEASE_VERSION
body: ${{ steps.github_release.outputs.changelog }}
name: Release $RELEASE_VERSION
make_latest: true