Skip to content

Commit 65d61d9

Browse files
#26388 updated cicd
1 parent 1d3c50a commit 65d61d9

File tree

3 files changed

+100
-55
lines changed

3 files changed

+100
-55
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/main.yml

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

.github/workflows/pull_requests.yml

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,62 @@
1-
name: PR workflow
2-
on: pull_request
1+
name: Build & Deploy to Minio
32

43
permissions:
5-
pull-requests: write
4+
contents: write
5+
6+
on:
7+
pull_request:
68

79
jobs:
10+
build-minio:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Use Node.js 18.x
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 18.x
18+
- run: yarn
19+
- run: yarn build
20+
- name: Create tar from built plugin
21+
run: |
22+
BUILDFOLDER="dist"
23+
MANIFEST=$(find ./$BUILDFOLDER -name plugin-manifest.json)
24+
[ -z $MANIFEST ] && cp plugin-manifest $BUILDFOLDER
25+
MANIFEST="$BUILDFOLDER/plugin-manifest.json"
26+
VERSION=$(jq '.version' $MANIFEST -r)
27+
URL=$(jq '.url' $MANIFEST -r)
28+
echo "version=$VERSION"
29+
mkdir -p output
30+
tar -C $BUILDFOLDER -czf output/$VERSION.tar.gz .
31+
ls -la output
32+
echo "version=$VERSION" >> $GITHUB_ENV
33+
REPO_NAME="$(basename $GITHUB_REPOSITORY)"
34+
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
35+
ENTRYPOINT_NAME=$(basename $URL)
36+
ENTRYPOINT_PATH=$(find ./$BUILDFOLDER -name $ENTRYPOINT_NAME | sed "s|^./$BUILDFOLDER/||")
37+
UPLOAD_URL="$MINIO_URL/flotiq-plugins-dev/$REPO_NAME/$GITHUB_HEAD_REF/$ENTRYPOINT_PATH"
38+
echo $UPLOAD_URL
39+
tmp=$(mktemp)
40+
jq --arg upload_url "$UPLOAD_URL" '.url = $upload_url' $MANIFEST > "$tmp" && mv "$tmp" $MANIFEST
41+
env:
42+
MINIO_URL: ${{ secrets.MINIO_ENDPOINT }}
43+
- name: Minio Deploy
44+
uses: lovellfelix/minio-deploy-action@v1
45+
with:
46+
endpoint: ${{ secrets.MINIO_ENDPOINT }}
47+
access_key: ${{ secrets.MINIO_ACCESS_KEY }}
48+
secret_key: ${{ secrets.MINIO_SECRET_KEY }}
49+
bucket: 'flotiq-plugins-dev'
50+
# Optional inputs with their defaults:
51+
source_dir: 'dist'
52+
target_dir: '/${{ env.REPO_NAME }}/${{ github.head_ref }}/'
53+
- name: Create artifact
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: plugin-package
57+
path: output/${{ env.version }}.tar.gz
858
dependabot:
959
runs-on: ubuntu-latest
10-
permissions:
11-
contents: write
12-
pull-requests: write
13-
repository-projects: write
1460
if: github.actor == 'dependabot[bot]'
1561
steps:
1662
- name: Dependabot metadata

0 commit comments

Comments
 (0)