-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (63 loc) · 2.13 KB
/
release.yml
File metadata and controls
73 lines (63 loc) · 2.13 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
---
name: release
run-name: release ${{ inputs.tag }}
on:
Uncomment to test your work as a release before it's merged
push:
branches:
- improvement/CLDSRVCLT-7
workflow_dispatch:
inputs:
tag:
description: 'Tag to be released (e.g., 1.0.0)'
required: true
jobs:
build-and-publish:
name: Build and publish to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup and Build
uses: ./.github/actions/setup-and-build
- name: Update package version
run: |
# Update version in package.json
npm version ${{ inputs.tag }} --no-git-tag-version
- name: Configure package for GitHub Packages
run: |
# Add publishConfig to package.json for GitHub Packages
node -e "
const pkg = require('./package.json');
pkg.publishConfig = {
registry: 'https://npm.pkg.github.com'
};
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"
- name: Setup .npmrc for authentication
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
echo "@${{ github.repository_owner }}:registry=https://npm.pkg.github.com" >> .npmrc
- name: Publish to GitHub Packages
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Git Tag
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ inputs.tag }}
git push origin ${{ inputs.tag }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag }}
name: Release ${{ inputs.tag }}
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}