Skip to content

create-tag-release

create-tag-release #31

name: Create Release
on:
repository_dispatch:
types: [create-tag-release]
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install jq
run: sudo apt-get install -y jq
- name: Get version from package.json
id: get_version
run: |
VERSION=$(jq -r '.version' package.json)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Setup Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create tag
run: |
git tag -a "v${{ env.VERSION }}" -m "Release v${{ env.VERSION }}"
git push https://${{ secrets.ACTIONS_PAT }}@github.com/${{ github.repository }}.git "v${{ env.VERSION }}"
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ env.VERSION }}"
release_name: "v${{ env.VERSION }}"
body: |
## Changes
$(git log --oneline $(git describe --tags --abbrev=0)..HEAD)
draft: false
prerelease: false
- name: Trigger Release components package workflow
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: create-npm-package