Skip to content

Commit 95a9414

Browse files
authored
Merge pull request #1 from flotiq/devops/build-action
add build action
2 parents 9b5aab4 + 8f03c59 commit 95a9414

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build & Release
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
workflow_dispatch:
10+
pull_request:
11+
12+
jobs:
13+
build-release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Use Node.js 18.x
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 18.x
21+
- run: yarn
22+
- run: yarn build
23+
- name: Create tar from built plugin
24+
run: |
25+
BUILDFOLDER="dist"
26+
MANIFEST=$(find ./$BUILDFOLDER -name plugin-manifest.json)
27+
[ -z $MANIFEST ] && cp plugin-manifest $BUILDFOLDER
28+
MANIFEST="$BUILDFOLDER/plugin-manifest.json"
29+
VERSION=$(jq '.version' $MANIFEST -r)
30+
echo "version=$VERSION"
31+
mkdir -p output
32+
tar -C $BUILDFOLDER -czf output/$VERSION.tar.gz .
33+
ls -la output
34+
echo "version=$VERSION" >> $GITHUB_ENV
35+
- name: Create artifact
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: plugin-package
39+
path: output
40+
- name: Release built plugin
41+
uses: svenstaro/upload-release-action@v2
42+
with:
43+
repo_token: ${{ secrets.GITHUB_TOKEN }}
44+
file: output/*
45+
tag: ${{ env.version }}
46+
overwrite: true
47+
file_glob: true
48+
if: github.ref == 'refs/heads/main'

0 commit comments

Comments
 (0)