This repository was archived by the owner on May 1, 2025. It is now read-only.
forked from epiphanysxp/embedly-node
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (78 loc) · 2.47 KB
/
release.yaml
File metadata and controls
82 lines (78 loc) · 2.47 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
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
uses: ./.github/workflows/build.yaml
secrets: inherit
publish:
name: Publish to npmjs.org
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .npmrc
run: cp tools/_.npmrc .npmrc
- uses: actions/download-artifact@v4
with:
name: dist.tar
- name: Unpack compilation artifact
run: mkdir dist && tar -xf dist.tar -C dist
- name: Configure the package.json for publishing
run: jq --arg version "${REF#refs\/tags\/v}" 'del(.devDependencies,.scripts,.private) | .version=$version' package.json > dist/package.json
env:
REF: ${{ github.ref }}
- name: Include README.md in the package
run: cp README.md dist/
- name: Publish the package
uses: docker://node:18.20.8-alpine3.21
with:
args: yarn --cwd dist publish --no-git-tag-version
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_RW }}
- name: Update compilation artifact
run: tar -cf ../dist-published.tar *
working-directory: dist
- uses: actions/upload-artifact@v4
with:
name: dist-published.tar
path: dist-published.tar
retention-days: 1
create-release:
name: Create GitHub Release
needs: [publish]
runs-on: ubuntu-latest
steps:
- name: Determine version
id: version
run: printf "tag=%s\n" "${REF#refs\/tags\/}" >> $GITHUB_OUTPUT
env:
REF: ${{ github.ref }}
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ steps.version.outputs.tag }}
- name: Get release notes from tag
id: tag-message
run: |
eof="$(openssl rand -hex 8)"
printf "message<<%s\n%s\n%s\n" "$eof" "$(git tag -l --format='%(contents)' "${REF#refs\/tags\/}")" "$eof" >> $GITHUB_OUTPUT
env:
REF: ${{ github.ref }}
- uses: actions/download-artifact@v4
with:
name: dist-published.tar
- name: Compress release artifact
run: gzip dist-published.tar && mv dist-published.tar.gz ${{ steps.version.outputs.tag }}.tar.gz
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: ${{ steps.version.outputs.tag }}
body: ${{ steps.tag-message.outputs.message }}
draft: false
prerelease: false
artifacts: ${{ steps.version.outputs.tag }}.tar.gz
artifactErrorsFailBuild: true
artifactContentType: application/gzip