-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build release artifacts | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.0' | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
- name: Install Ruby dependencies | ||
run: bundle install | ||
|
||
- name: Install Node dependencies | ||
run: npm ci | ||
|
||
- name: Build JavaScript library | ||
run: npm run build | ||
|
||
- name: Build distributable Ruby library | ||
run: bundle exec rake build_dist | ||
|
||
- name: Build sample SketchUp extension | ||
run: bundle exec rake build_sample_extension | ||
|
||
- name: Build tutorial SketchUp extension | ||
run: bundle exec rake build_tutorial_rbz | ||
|
||
- name: Include built files in repository | ||
uses: devops-infra/action-commit-push@master | ||
with: | ||
github_token: "${{ secrets.GITHUB_TOKEN }}" | ||
commit_message: "[AUTO] Update sample files" | ||
force: false | ||
target_branch: main | ||
|
||
- name: Add tutorial SketchUp extension to release | ||
uses: actions/github-script@v7 | ||
env: | ||
path: ae_bridgelibrary*.rbz | ||
with: | ||
script: | | ||
// From https://til.simonwillison.net/github-actions/attach-generated-file-to-release | ||
const fs = require('fs') | ||
const path = require('path') | ||
// Resolve any wildcards with glob (by default included from @actions/glob) | ||
const globber = await glob.create(process.env.path) | ||
const assetPath = (await globber.glob())[0] | ||
// Get release for this tag | ||
const tag = context.ref.replace('refs/tags/', '') | ||
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) | ||
}) | ||
publish-npm: | ||
name: Publish JavaScript library on NPM | ||
# We could specify `needs: build` and publish the compiled code (as in <=3.0.7) | ||
# but the source is more useful for development and optimization of other SketchUp plugins. | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.npm_token}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
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 | ||
with: | ||
node-version: 18 | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build JavaScript library | ||
run: npm run dev | ||
|
||
- name: Run JavaScript tests | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,6 @@ node_modules | |
.yardoc | ||
doc | ||
|
||
# Exclude built SketchUp extension | ||
*.rbz | ||
|