-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (106 loc) · 3.41 KB
/
Copy pathrelease.yml
File metadata and controls
124 lines (106 loc) · 3.41 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Automatic Multi-Platform Release
on:
push:
workflow_dispatch:
permissions:
contents: write
env:
NODE_VERSION: '20'
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.metadata.outputs.release_tag }}
release_name: ${{ steps.metadata.outputs.release_name }}
release_body: ${{ steps.metadata.outputs.release_body }}
short_sha: ${{ steps.metadata.outputs.short_sha }}
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.2
- name: Setup Node.js
uses: actions/setup-node@v6.3.0
with:
node-version: ${{ env.NODE_VERSION }}
- name: Generate release metadata
id: metadata
shell: bash
run: |
short_sha="${GITHUB_SHA::7}"
package_version="$(node -p "require('./package.json').version")"
release_tag="snapshot-${GITHUB_SHA}"
release_name="Snapshot ${package_version} (${short_sha})"
{
echo "short_sha=${short_sha}"
echo "release_tag=${release_tag}"
echo "release_name=${release_name}"
echo "release_body<<EOF"
echo "Automatic multi-platform release generated from commit ${GITHUB_SHA}."
echo
echo "- Branch: ${GITHUB_REF_NAME}"
echo "- Package version: ${package_version}"
echo "- Commit: ${short_sha}"
echo "- Triggered by: ${GITHUB_ACTOR}"
echo
echo "Assets are built and smoke-tested on Linux, macOS and Windows."
echo "EOF"
} >> "$GITHUB_OUTPUT"
build:
needs: prepare
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
- os: macos-latest
platform: macos
- os: windows-latest
platform: windows
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.2
- name: Setup Node.js
uses: actions/setup-node@v6.3.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Build CLI
run: npm run build
- name: Smoke test CLI
run: node ./out/cli.cjs --help
- name: Package release artifact
shell: bash
run: |
mkdir -p dist
npm pack --pack-destination dist
package_file="$(find dist -maxdepth 1 -name '*.tgz' -print -quit)"
mv "$package_file" "dist/alcapush-${{ matrix.platform }}-${{ needs.prepare.outputs.short_sha }}.tgz"
- name: Upload release artifact
uses: actions/upload-artifact@v7.0.0
with:
name: release-${{ matrix.platform }}
path: dist/*.tgz
if-no-files-found: error
retention-days: 14
release:
needs:
- prepare
- build
runs-on: ubuntu-latest
steps:
- name: Download packaged artifacts
uses: actions/download-artifact@v8.0.1
with:
path: release-assets
merge-multiple: true
- name: Publish GitHub release
uses: softprops/action-gh-release@v2.6.1
with:
tag_name: ${{ needs.prepare.outputs.release_tag }}
name: ${{ needs.prepare.outputs.release_name }}
body: ${{ needs.prepare.outputs.release_body }}
prerelease: true
files: release-assets/*