Skip to content

Commit

Permalink
Create automatic releases
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelderuiter committed Oct 9, 2023
1 parent 7e11438 commit 65661a3
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 39 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/npm-publish-github-packages.yml

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Create a new release and a publish to GitHub Package Registry

on:
workflow_dispatch:
push:
branches:
- 'main'

jobs:
release:
name: Create a new release
runs-on: ubuntu-latest
outputs:
tag: "${{ steps.version.outputs.tag }}"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
env:
GITHUB_TOKEN: "${{ secrets.GH_PAT }}"
- name: 'Get next minor version'
id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.previoustag.outputs.tag }}
- name: 'Set the next version to use'
id: version
run: |
if [[ "${{ steps.semvers.outputs.patch }}" == *.9 ]]
then
echo "tag=${{ steps.semvers.outputs.minor }}" >> $GITHUB_OUTPUT
else
echo "tag=${{ steps.semvers.outputs.patch }}" >> $GITHUB_OUTPUT
fi
- name: 'Create a tag and release'
uses: "softprops/action-gh-release@v1"
env:
GITHUB_TOKEN: "${{ secrets.GH_PAT }}"
with:
tag_name: "${{ steps.version.outputs.tag }}"

build:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test

publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm version "${{ release.steps.version.outputs.tag }}" -m "Release ${{ release.steps.version.outputs.tag }} 📣"
- name: Authenticate with the GitHub Package Registry
run: echo "//npm.pkg.github.com:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "editorjs-layout",
"name": "@manuelderuiter/editorjs-layout",
"version": "1.2.6",
"description": "Layout block tool for Editor.js. ",
"keywords": [
Expand All @@ -10,12 +10,15 @@
"tool"
],
"publishConfig": {
"registry": "https://npm.pkg.github.com"
"registry": "https://npm.pkg.github.com/manuelderuiter/editorjs-layout"
},
"bugs": {
"url": "https://github.com/manuelderuiter/editorjs-layout/issues"
},
"repository": "https://github.com/manuelderuiter/editorjs-layout.git",
"repository": {
"type": "git",
"url": "git+https://github.com/manuelderuiter/editorjs-layout.git"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/hata6502"
Expand Down

0 comments on commit 65661a3

Please sign in to comment.