Skip to content

Commit

Permalink
Loc 673 update ci with changelogs and automatic releases (#3)
Browse files Browse the repository at this point in the history
* 🔧 chore: Update release workflow

* 🔧 chore: Update CI

* 🔧 chore: Remove unused packaged

* 🔧 chore: Add QA workflow

* 🔧 chore: Update workflow runs-on

* 🔧 chore: Add typedoc-plugin-missing-exports plugin
  • Loading branch information
honzabubenik authored Nov 9, 2023
1 parent 16b175d commit e76da0a
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 3,663 deletions.
63 changes: 0 additions & 63 deletions .czrc

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: QA checks

on:
pull_request:
branches:
- main

jobs:
build:
name: Build package
runs-on: [ self-hosted, Linux ]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install dependencies
run: npm ci --ignore-scripts

- name: Build package
run: npm run build

lint:
name: Lint source files
runs-on: [ self-hosted, Linux ]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install dependencies
run: npm ci --ignore-scripts

- name: Lint source files
run: npm run lint

# test:
# name: Run tests
# runs-on: [ self-hosted, Linux ]
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
#
# - name: Setup Node
# uses: actions/setup-node@v3
# with:
# node-version: 16
#
# - name: Install dependencies
# run: npm ci --ignore-scripts
#
# - name: Run tests
# run: npm run test
113 changes: 24 additions & 89 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Release CI

on:
push:
branches:
Expand All @@ -7,97 +9,30 @@ permissions:
contents: write
pull-requests: write

name: release

env:
IS_MERGED_RELEASE_PR: ${{ startsWith(github.event.head_commit.message, '🚀 release:') }}

jobs:
release:
runs-on: ubuntu-latest
prepare:
name: Prepare Release
if: github.event.head.ref != 'release' && !contains(github.event.commits[0].message, '🚀 release:')
runs-on: [ self-hosted, Linux ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup GIT
uses: fregante/setup-git-user@v2

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
if: ${{ env.IS_MERGED_RELEASE_PR == 'false' }}
run: npm ci --ignore-scripts

- name: Install dependencies and build package
if: ${{ env.IS_MERGED_RELEASE_PR == 'true' }}
run: npm ci

- name: Decide bump type
if: ${{ env.IS_MERGED_RELEASE_PR == 'false' }}
id: bump-type
run: echo "bump=$(npx conventional-recommended-bump -p @localazy/conventional-changelog-preset)" > "$GITHUB_OUTPUT"

- name: Bump version
if: ${{ env.IS_MERGED_RELEASE_PR == 'false' }}
run: npm version ${{ steps.bump-type.outputs.bump }} --git-tag-version false

- name: Update changelog
if: ${{ env.IS_MERGED_RELEASE_PR == 'false' }}
run: npx conventional-changelog -p @localazy/preset -u -i CHANGELOG.md -s

- name: Preview changelog
if: ${{ env.IS_MERGED_RELEASE_PR == 'false' }}
id: preview-changelog
run: |
{
echo 'changelog<<EOF'
npx conventional-changelog -p @localazy/preset -u
echo EOF
} > "$GITHUB_OUTPUT"
- name: Read package.json version
id: package-version
uses: martinbeentjes/[email protected]

- name: Create release PR
if: ${{ env.IS_MERGED_RELEASE_PR == 'false' }}
uses: peter-evans/create-pull-request@v5
- name: Prepare release branch and PR
uses: localazy/release@v1
with:
branch: "release"
commit-message: "🚀 release: ${{ steps.package-version.outputs.current-version }}"
delete-branch: true
labels: release-preview
title: ${{ steps.package-version.outputs.current-version }}
body: ${{ steps.preview-changelog.outputs.changelog }}

- name: Read changelog
if: ${{ env.IS_MERGED_RELEASE_PR == 'true' }}
id: read-changelog
run: |
{
echo 'changelog<<EOF'
npx conventional-changelog -p @localazy/preset -r 1
echo EOF
} > "$GITHUB_OUTPUT"
action: prepare
app-id: ${{ secrets.AUTH_APP_ID }}
app-key: ${{ secrets.AUTH_APP_KEY }}

- name: Git tag, GitHub release
if: ${{ env.IS_MERGED_RELEASE_PR == 'true' }}
uses: avakar/tag-and-release@v1
release:
name: Release
if: github.event.head.ref == 'release' || contains(github.event.commits[0].message, '🚀 release:')
runs-on: [ self-hosted, Linux ]
steps:
- name: Release new version
uses: localazy/release@v1
with:
tag_name: ${{ steps.package-version.outputs.current-version }}
release_name: ${{ steps.package-version.outputs.current-version }}
body: ${{ steps.read-changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Publish NPM package
# if: ${{ env.IS_MERGED_RELEASE_PR == 'true' }}
# run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
action: release
app-id: ${{ secrets.AUTH_APP_ID }}
app-key: ${{ secrets.AUTH_APP_KEY }}
npm-publish: true
npm-access: true
npm-token: ${{ secrets.NPM_AUTH_TOKEN }}
Loading

0 comments on commit e76da0a

Please sign in to comment.