Skip to content

Commit

Permalink
fix: release workflow and use of semantic-release
Browse files Browse the repository at this point in the history
  • Loading branch information
matubu committed Jul 30, 2023
1 parent e35a6ae commit 3f64b35
Show file tree
Hide file tree
Showing 5 changed files with 6,738 additions and 416 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/jsdoc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: jsdoc-workflow
name: JSdoc

on:
# Triggers the workflow on push events but only for the main or dev branch
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/minify.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: minify-workflow
name: Minify

on:
# Triggers the workflow on push events but only for the main or dev branch
Expand Down
80 changes: 24 additions & 56 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,35 @@
name: npm-pkg-workflow
name: Release

on:
# Triggers the workflow on new release
release:
types: [ published ]
"on":
push:
branches:
- main

concurrency:
group: push
permissions:
contents: read # for checkout

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5

release:
permissions:
contents: write
packages: write
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance

name: release
runs-on: ubuntu-latest
steps:
- name: Set up workspace
uses: actions/checkout@v2

- name: Create new npm version
run: |
git branch
git checkout main
git branch
npm version --no-git-tag-version ${{ github.event.release.tag_name }}
git branch
git add package.json
git -c user.name='npm-pkg-bot' -c user.email='speed-highlight@protonmail.com' commit -m "[npm-pkg-bot] updated package.json to version ${{ github.event.release.tag_name }}"
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
scope: '@speed-highlight'

- name: Publish to npm
run: |
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Set up Node
uses: actions/setup-node@v1
- uses: actions/checkout@3 # v3
- uses: actions/setup-node@3 # v3
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
scope: '@speed-highlight'
cache: npm
node-version: lts/*

- name: Publish to github pkg
run: |
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm clean-install
- run: npm audit signatures
- run: npm run build

- name: Push new version to github
run: |
git log
git status
git config --get remote.origin.url
git push
- run: npx semantic-release
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading

0 comments on commit 3f64b35

Please sign in to comment.