-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (79 loc) · 2.84 KB
/
semantic-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Fully automated release using semantic-release.
# By default, creates a GitHub release on branch "main" using the conventionalcommits preset.
name: ♻ semantic-release
on:
workflow_call:
inputs:
runs_on:
description: The label of the runner (GitHub- or self-hosted) to run this workflow on. Defaults to `ubuntu-24.04`.
type: string
required: false
default: ubuntu-24.04
branches:
description: A newline-separated string of branches to release on.
type: string
required: false
default: |-
main
preset:
description: Which preset to use for semantic-release.
type: string
required: false
default: conventionalcommits
plugins:
description: A newline-separated string of default plugins to use.
type: string
required: false
default: |-
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/github
additional_plugins:
description: A newline-separated string of additional plugins to install.
type: string
required: false
default: |-
conventional-changelog-conventionalcommits
node_version:
description: Specify specific version of Node.js, with default set to latest version.
type: string
required: false
default: lts/*
semantic_version:
description: Specify specific version of semantic-release, with default set to latest version.
type: string
required: false
default: latest
permissions: {}
jobs:
semantic-release:
name: semantic-release
runs-on: ${{ inputs.runs_on }}
permissions:
contents: read # Required to checkout the repository
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: ${{ inputs.node_version }}
- name: Install additional plugins
env:
ADDITIONAL_PLUGINS: ${{ inputs.additional_plugins }}
run: |
readarray -t plugins_array <<< "$ADDITIONAL_PLUGINS"
npm install "${plugins_array[@]}"
- name: Release
env:
BRANCHES: ${{ inputs.branches }}
PLUGINS: ${{ inputs.plugins }}
PRESET: ${{ inputs.preset }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEMANTIC_VERSION: ${{ inputs.semantic_version }}
run: |
readarray -t branches_array <<< "$BRANCHES"
readarray -t plugins_array <<< "$PLUGINS"
npx "semantic-release@$SEMANTIC_VERSION" --branches "${branches_array[@]}" --plugins "${plugins_array[@]}" --preset "$PRESET"