Skip to content

Commit

Permalink
Merge pull request #4 from klarna-incubator/build
Browse files Browse the repository at this point in the history
Build
  • Loading branch information
katrotz authored Jun 24, 2024
2 parents 99cb1cc + 25875bb commit d658088
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 14 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,23 @@ on:
push:
branches:
- master
- release
tags:
- v*
pull_request:
branches:
- master
- release

jobs:
check:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18.x', '20.x']
node-version: ['18', '20', '22']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Release package
on:
workflow_dispatch:
inputs:
release-type:
description: 'Release type (one of): patch, minor, major, prepatch, preminor, premajor, prerelease'
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
# Checkout project repository
- name: Checkout
uses: actions/checkout@v3

# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: '20'

- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test
- name: Build
run: yarn build

# Configure Git
# - name: Git configuration
# run: |
## git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# git config --global user.name "GitHub Actions"

# Bump package version
# Use tag latest
- name: Bump release version
if: startsWith(github.event.inputs.release-type, 'pre') != true
run: |
echo "NEW_VERSION=$(npm --no-git-tag-version version $RELEASE_TYPE)" >> $GITHUB_ENV
echo "RELEASE_TAG=latest" >> $GITHUB_ENV
env:
RELEASE_TYPE: ${{ github.event.inputs.release-type }}

# Bump package pre-release version
# Use tag beta for pre-release versions
- name: Bump pre-release version
if: startsWith(github.event.inputs.release-type, 'pre')
run: |
echo "NEW_VERSION=$(npm --no-git-tag-version --preid=beta version $RELEASE_TYPE
echo "RELEASE_TAG=beta" >> $GITHUB_ENV
env:
RELEASE_TYPE: ${{ github.event.inputs.release-type }}

# Update changelog unreleased section with new version
- name: Update changelog
uses: superfaceai/release-changelog-action@v1
with:
path-to-changelog: CHANGELOG.md
version: ${{ env.NEW_VERSION }}
operation: release

# Commit changes
- name: Commit CHANGELOG.md and package.json changes and create tag
run: |
git add "package.json"
git add "CHANGELOG.md"
git commit -m "chore: release ${{ env.NEW_VERSION }}"
git tag ${{ env.NEW_VERSION }}
# Publish version to public repository
- name: Publish
run: yarn publish --verbose --access public --tag ${{ env.RELEASE_TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

# Push repository changes
- name: Push changes to repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin && git push --tags
# Read version changelog
- id: get-changelog
name: Get version changelog
uses: superfaceai/release-changelog-action@v1
with:
path-to-changelog: CHANGELOG.md
version: ${{ env.NEW_VERSION }}
operation: read

# Update GitHub release with changelog
- name: Update GitHub release documentation
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.NEW_VERSION }}
body: ${{ steps.get-changelog.outputs.changelog }}
prerelease: ${{ startsWith(github.event.inputs.release-type, 'pre') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 2 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.1] - yyyy-mm-dd
- A changelog is a file which contains a curated, chronologically ordered list of notable changes for each version of a project.
## [Unreleased]

### Added

- To make it easier for users and contributors to see precisely what notable changes have been made between each release (or version) of the project.

<!-- Markdown link dfn's -->
[0.0.1]: https://github.com/klarna-incubator/TODO/releases/tag/v0.0.1
- Changelog
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Nest Lambda Microservice
[![main](https://github.com/klarna-incubator/nest-lambda-microservice/actions/workflows/main.yml/badge.svg)](https://github.com/klarna-incubator/nest-lambda-microservice/actions/workflows/main.yml)
[//]: # ([![Build Status][ci-image]][ci-url])
[//]: # ([![License][license-image]][license-url])
[//]: # ([![Developed at Klarna][klarna-image]][klarna-url])
([![Build Status][ci-image]][ci-url])
([![License][license-image]][license-url])
([![Developed at Klarna][klarna-image]][klarna-url])

> Custom transporter implementation for running NestJS based applications on AWS Lambda.
Expand All @@ -13,6 +13,8 @@ The **nest-lambda-microservice** is a custom [NestJS transporter](https://docs.n
- [Overview](#overview)
- [Pattern Matching](#pattern-matching)
- [Message Processing](#message-processing)
- [Release History](#release-history)
- [License](#license)

## Overview
In addition to the traditional HTTP style architecture, NestJS framework support writing microservice applications that use transport layers other than HTTP.
Expand Down Expand Up @@ -177,6 +179,7 @@ interface SqsRecordPattern {
The message payload is a Record from the original SQS event.

For more details see [this example](examples/sqs).

## How to contribute

See our guide on [contributing](.github/CONTRIBUTING.md).
Expand All @@ -187,7 +190,7 @@ See our [changelog](CHANGELOG.md).

## License

Copyright © 2023 Klarna Bank AB
Copyright © 2024 Klarna Bank AB

For license details, see the [LICENSE](LICENSE) file in the root of this project.

Expand Down

0 comments on commit d658088

Please sign in to comment.