Skip to content

Commit

Permalink
Add GH Action to create release
Browse files Browse the repository at this point in the history
  • Loading branch information
jocmp committed Dec 16, 2024
1 parent 4f8e06a commit 1da85b9
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy Production

on:
workflow_dispatch:
inputs:
version:
type: choice
description: Select version bump
options:
- major
- minor
- patch

jobs:
production:
runs-on: ubuntu-latest
permissions:
contents: write
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version-file: ".tool-versions"
- name: Setup build dependencies
run: make deps
- name: Configure Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Build
run: |
yarn run release
git add dist/
- name: Bump Version
run: |
bumpver update --${{ github.event.inputs.version }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dist/mercury_test.js
dist/mercury_test.js.map
dist/mercury_test.web.js
tmp/artifacts
tmp/CHANGELOG.md
test-output.json
.yarnrc.yml
**/.DS_Store
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
SHELL :=/usr/bin/env bash

CHANGELOG=CHANGELOG.md
CHANGELOG_TMP=tmp/$(CHANGELOG)

.PHONY: deps
deps: ## Install bumpver
pip install bumpver==2024.1130

$(CHANGELOG_TMP):
mkdir -p tmp
echo -e "# Mercury Parser Changelog\n" > $(CHANGELOG_TMP)
echo $(now)
echo -e "### $(BUMPVER_NEW_VERSION) ($$(date '+%b %d, %Y'))\n" >> $(CHANGELOG_TMP)
yarn run --silent changelog-maker --format=markdown >> $(CHANGELOG_TMP)
cat $(CHANGELOG) | sed 1d >> $(CHANGELOG_TMP)
cp $(CHANGELOG_TMP) $(CHANGELOG)

$(CHANGELOG): $(CHANGELOG_TMP)

.PHONY: changelog
changelog: $(CHANGELOG)
15 changes: 15 additions & 0 deletions bumpver.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[bumpver]
current_version = "2.2.3"
version_pattern = "[MAJOR].[MINOR].[PATCH]"
commit_message = "bump version {old_version} -> {new_version}"
tag_message = "{new_version}"
tag_scope = "default"
pre_commit_hook = "scripts/update-changelog"
post_commit_hook = ""
commit = true
tag = true
push = false

[bumpver.file_patterns]
"package.json" = ['"version": "{version}"']
"bumpver.toml" = ['current_version = "{version}"']
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jocmp/mercury-parser",
"version": "2.2.3-dev",
"version": "2.2.3",
"description": "Mercury Parser transforms web pages into clean text. Publishers and programmers use it to make the web make sense, and readers use it to read any web article comfortably.",
"author": "jocmp <[email protected]>",
"homepage": "https://github.com/jocmp/mercury-parser",
Expand Down
4 changes: 4 additions & 0 deletions scripts/update-changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

make changelog
git add CHANGELOG.md

0 comments on commit 1da85b9

Please sign in to comment.