-
Notifications
You must be signed in to change notification settings - Fork 8
86 lines (83 loc) · 2.66 KB
/
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
name: Release SketchUp extension
on:
push
# release:
# types:
# - created
jobs:
build_javascript:
name: Build JavaScript library
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
- name: Install dependencies
run: npm install
- name: Build JavaScript library
run: npm run build
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: js-lib
path: src/ae_attribute_inspector/js/main.js
build_sketchup_extension:
name: Build SketchUp extension rbz package
runs-on: ubuntu-latest
needs: build_javascript
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Install dependencies
run: bundle install
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: js-lib
path: src/ae_attribute_inspector/js/main.js
- name: Build package
run: bundle exec rake build_rbz
# - name: Archive production artifacts
# uses: actions/upload-artifact@v4
# with:
# path: ae_attribute_inspector*.rbz
- run: ls .
- name: Add package to release
uses: actions/github-script@v7
env:
path: ae_attribute_inspector*.rbz
with:
script: |
// From https://til.simonwillison.net/github-actions/attach-generated-file-to-release
const fs = require('fs')
console.log('after require fs')
const path = require('path')
console.log('after require path')
const tag = context.ref.replace('refs/tags/', '')
console.log('tag='+tag)
console.log('process.env.path='+process.env.path)
// Resolve any wildcards with glob (by default included from @actions/glob)
const globber = await glob.create(process.env.path)
console.log(globber);
const assetPath = await globber.glob()[0]
console.log(assetPath)
console.log(path.basename(assetPath))
// Get release for this tag
const release = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag
})
// Upload the release asset
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: path.basename(assetPath),
data: await fs.readFileSync(assetPath)
})