Skip to content

Commit

Permalink
ci: implements release-please (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
udondan authored Mar 8, 2024
1 parent 47128c6 commit 56f7055
Show file tree
Hide file tree
Showing 17 changed files with 5,553 additions and 32 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/pr-conventional-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Conventional PR Title

on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize

jobs:
conventional-pr-title:
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- uses: aslafy-z/conventional-pr-title-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 0 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}

- name: Checkout code
uses: actions/checkout@v4
with:
Expand All @@ -24,7 +19,6 @@ jobs:
- name: Build source
uses: udondan/[email protected]
with:
VERSION: ${{ steps.get_version.outputs.VERSION }}
BUILD_SOURCE: true

- name: Build packages
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: release-please

on:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
token: ${{ secrets.OVERRIDE_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ jobs:
with:
fetch-depth: 1

- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: .npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Set Build Permissions
run: |
mkdir $GITHUB_WORKSPACE/test/cdk.out
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ lambda/*
!lambda/*.ts
!lambda/build
!lambda/package.json
!lambda/package-lock.json
**/*.js
**/*.d.ts
**/cdk.out
**/cdk.context.json
**/package-lock.json
tsconfig.tsbuildinfo
.npm
*.tgz
12 changes: 12 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,15 @@ dist
!.jsii

test
.npm
.github
.release-please-manifest.json
CHANGELOG.md
Makefile
release-please-config.json
renovate.json
tsconfig.tsbuildinfo
*.tgz

lambda/*
!lambda/code.zip
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "3.3.3"
}
Empty file added CHANGELOG.md
Empty file.
33 changes: 15 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
SHELL := /bin/bash
VERSION := $(shell cat VERSION)
SHELL := /bin/bash -euo pipefail

NO_COLOR=\x1b[0m
TARGET_COLOR=\x1b[96m

build:
@echo -e "$(TARGET_COLOR)Running build$(NO_COLOR)"
@npm run build

package: build
@echo -e "$(TARGET_COLOR)Running package$(NO_COLOR)"
@npm run package

clean:
@echo -e "$(TARGET_COLOR)Running clean$(NO_COLOR)"
@rm -rf node_modules package-lock.json

install: clean
@npm i
install:
@echo -e "$(TARGET_COLOR)Running install$(NO_COLOR)"
@npm clean-install --prefer-offline --cache .npm
@npm list

test: build
npm run test
@echo -e "$(TARGET_COLOR)Running test$(NO_COLOR)"
@npm run test

test-update:
npm run test -- -u

tag:
@git tag -a "v$(VERSION)" -m 'Creates tag "v$(VERSION)"'
@git push --tags

untag:
@git push --delete origin "v$(VERSION)"
@git tag --delete "v$(VERSION)"

release: tag

re-release: untag tag
@echo -e "$(TARGET_COLOR)Running test-update$(NO_COLOR)"
@npm run test -- -u
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

2 changes: 1 addition & 1 deletion lambda/build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e
cd "$( dirname "${BASH_SOURCE[0]}" )"
npm i
npm clean-install --prefer-offline --cache ../.npm
npx tsc ./*.ts
zip -r code.zip ./*.js node_modules
rm ./*.js
38 changes: 38 additions & 0 deletions lambda/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 56f7055

Please sign in to comment.