Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name-template: 'Version $RESOLVED_VERSION'
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
template: |
Expand All @@ -9,7 +9,7 @@ template: |

---

*Full Changelog**: https://github.com/finos/git-proxy/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
**Full Changelog**: https://github.com/finos/git-proxy/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION

categories:
- title: '🚀 Features'
Expand Down Expand Up @@ -44,10 +44,7 @@ version-resolver:
autolabeler:
- label: 'automation'
title:
- '/^(ci|perf|refactor|test).*/i'
- label: 'enhancement'
title:
- '/^(style).*/i'
- '/^(ci|perf|refactor|test|style).*/i'
- label: 'documentation'
title:
- '/^(docs).*/i'
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Add PR Labels

on:
pull_request_target:
types: [opened, reopened, synchronize]

permissions:
contents: read

jobs:
auto_label:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter/autolabeler@563bf132657a13ded0b01fcb723c5a58cdd824e2
with:
config-name: release-drafter-config.yml
52 changes: 47 additions & 5 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ name: Publish to NPM
on:
release:
types: [published]
workflow_dispatch:
inputs:
dry_run:
required: false
default: 'true'
type: choice
options:
- 'true'
- 'false'

permissions:
contents: read
id-token: write
Expand All @@ -24,13 +34,45 @@ jobs:
- run: npm ci
- run: npm run build

- name: Check if pre-release and publish to NPM
- name: Determine dist-tag and publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'false' }}
run: |
set -euo pipefail
VERSION=$(node -p "require('./package.json').version")
PKG_NAME=$(node -p "require('./package.json').name")
echo "Publishing $PKG_NAME@$VERSION"

# Build the publish command flags.
PUBLISH_FLAGS=(--access=public)
if [[ "$DRY_RUN" == "true" ]]; then
PUBLISH_FLAGS+=(--dry-run)
echo "DRY RUN — nothing will actually be published."
fi

# Pre-releases (ex: 2.1.0-rc.1) get tagged as 'rc'
if [[ "$VERSION" == *"-"* ]]; then
echo "Publishing pre-release: $VERSION"
npm publish --access=public --tag rc
echo "Pre-release detected, publishing under 'rc' tag"
npm publish "${PUBLISH_FLAGS[@]}" --tag rc
exit 0
fi

# Look up current 'latest' on NPM. If never published before,
# defaults to 0.0.0 so any release (0.1.0, 1.0.0, etc.) becomes latest
CURRENT_LATEST=$(npm view "$PKG_NAME" version 2>/dev/null || echo "0.0.0")
echo "Current 'latest' on npm: $CURRENT_LATEST"

# If this version is strictly greater than the current 'latest',
# it becomes latest
if npx --yes semver "$VERSION" -r ">$CURRENT_LATEST" >/dev/null 2>&1; then
echo "Publishing as 'latest'"
npm publish "${PUBLISH_FLAGS[@]}"
else
echo "Publishing stable release: $VERSION"
npm publish --access=public
# Otherwise, this is a maintenance release on an older line
# Tag as v<major>.<minor> so users can pin to it
MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2)
DIST_TAG="release-${MAJOR_MINOR}"
echo "Maintenance release detected, publishing under '$DIST_TAG' tag"
npm publish "${PUBLISH_FLAGS[@]}" --tag "$DIST_TAG"
fi
33 changes: 33 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release Drafter

on:
push:
branches:
- 'release/**'

permissions:
contents: read

jobs:
update_release_draft:
permissions:
# Required to create/update the draft release
# Autolabeling runs in a separate workflow so this job only
# needs to read merged PRs
contents: write
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit

- uses: release-drafter/release-drafter@563bf132657a13ded0b01fcb723c5a58cdd824e2
with:
# Target the branch that triggered this run
# Ex: "release/2.1" becomes the commitish for the draft
commitish: ${{ github.ref_name }}
repository: ${{ github.repository }}
config-name: release-drafter-config.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading