mirror of
https://github.com/codex-team/editor.js
synced 2024-06-07 16:32:22 +02:00
92 lines
2.6 KiB
YAML
92 lines
2.6 KiB
YAML
|
name: Create a release draft
|
||
|
|
||
|
on:
|
||
|
pull_request:
|
||
|
branches:
|
||
|
- next
|
||
|
types: [closed]
|
||
|
|
||
|
jobs:
|
||
|
# If pull request was merged then we should check for a package version update
|
||
|
check-version-changing:
|
||
|
if: github.event.pull_request.merged == true
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
# Checkout to target branch
|
||
|
- uses: actions/checkout@v2
|
||
|
with:
|
||
|
# Pull submodules
|
||
|
submodules: 'recursive'
|
||
|
|
||
|
- name: Check if version has been updated
|
||
|
id: check
|
||
|
uses: EndBug/version-check@v1
|
||
|
with:
|
||
|
diff-search: true
|
||
|
|
||
|
- name: Throw an error and stop workflow if no version changes
|
||
|
uses: actions/github-script@v3
|
||
|
if: steps.check.outputs.changed != 'true'
|
||
|
with:
|
||
|
script: |
|
||
|
core.setFailed('No version changes')
|
||
|
|
||
|
# Create a new draft release
|
||
|
release-draft:
|
||
|
needs: check-version-changing
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
# Checkout to target branch
|
||
|
- uses: actions/checkout@v2
|
||
|
with:
|
||
|
# Pull submodules
|
||
|
submodules: 'recursive'
|
||
|
|
||
|
# Setup node environment
|
||
|
- uses: actions/setup-node@v1
|
||
|
with:
|
||
|
node-version: 15
|
||
|
registry-url: https://registry.npmjs.org/
|
||
|
|
||
|
# Prepare, build and publish project
|
||
|
- name: Install dependencies
|
||
|
run: yarn
|
||
|
|
||
|
# Build Editor.js
|
||
|
- name: Build output files
|
||
|
run: yarn build
|
||
|
|
||
|
# Get package version name
|
||
|
- name: Get package info
|
||
|
id: package
|
||
|
uses: codex-team/action-nodejs-package-info@v1
|
||
|
|
||
|
- name: Create Release
|
||
|
id: create_release
|
||
|
uses: actions/create-release@v1
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
with:
|
||
|
tag_name: v${{ steps.package.outputs.version }}
|
||
|
release_name: v${{ steps.package.outputs.version }}
|
||
|
|
||
|
# Fill release description from pull request body name
|
||
|
body: "${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}"
|
||
|
|
||
|
# Save as a draft release
|
||
|
draft: true
|
||
|
|
||
|
# If version name contains "-rc" suffix than mark a "pre-release" checkbox
|
||
|
prerelease: ${{ contains(steps.package.outputs.version, '-rc') }}
|
||
|
|
||
|
# Build and upload target Editor.js build to release as artifact
|
||
|
- name: Upload Release Asset
|
||
|
uses: actions/upload-release-asset@v1
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
with:
|
||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||
|
asset_path: dist/editor.js
|
||
|
asset_name: editor.js
|
||
|
asset_content_type: application/javascript
|