-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (78 loc) · 2.72 KB
/
Copy pathsemantic-version-apply.yml
File metadata and controls
89 lines (78 loc) · 2.72 KB
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
name: Semantic Version - Apply
on:
workflow_call:
inputs:
project_dir:
description: 'Directory where the Semantic Release configuration is located'
type: string
required: false
DEBUG:
description: 'Run the workflow in debug mode'
type: boolean
required: false
default: false
outputs:
release_notes:
description: 'Release notes generated by semantic-release'
value: ${{ jobs.Apply-Version.outputs.release_notes }}
secrets:
sem_rel_token_token:
required: true
jobs:
Apply-Version:
name: Apply Version
runs-on: ubuntu-latest
outputs:
release_notes: ${{ steps.extract_notes.outputs.release_notes }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
clean: false
persist-credentials: false
env:
GITHUB_TOKEN: ${{ secrets.sem_rel_token_token }}
- name: cache NPM
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: npm-cache
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup Node.js environment
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "lts/*"
- name: Set PROJECT_DIR environment variable
if: ${{ inputs.project_dir != '' }}
run: echo "PROJECT_DIR=${{ inputs.project_dir }}" >> "$GITHUB_ENV"
- name: Install Semantic Release
run: |
cd ${{ env.PROJECT_DIR || '.' }}
npm ci
- name: Apply release
run: |
cd ${{ env.PROJECT_DIR || '.' }}
npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.sem_rel_token_token }}
GIT_COMMITTER_NAME: "Arc-E-Tect Versioning bot"
GIT_COMMITTER_EMAIL: "sedr@arc-e-tect.com"
GIT_AUTHOR_NAME: "Arc-E-Tect Versioning bot"
GIT_AUTHOR_EMAIL: "sedr@arc-e-tect.com"
- name: Pull latest changes including CHANGELOG
run: |
cd ${{ env.PROJECT_DIR || '.' }}
git pull https://x-access-token:${{ secrets.sem_rel_token_token }}@github.com/${{ github.repository }}.git ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.sem_rel_token_token }}
- name: Extract release notes
id: extract_notes
uses: ./.github/actions/extract-release-notes
with:
project_dir: ${{ env.PROJECT_DIR || '.' }}
max_length: '1500'