|
1 |
| -name: PR workflow |
2 |
| -on: pull_request |
| 1 | +name: Build & Deploy to Minio |
3 | 2 |
|
4 | 3 | permissions:
|
5 |
| - pull-requests: write |
| 4 | + contents: write |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
6 | 8 |
|
7 | 9 | 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 |
8 | 58 | dependabot:
|
9 | 59 | runs-on: ubuntu-latest
|
10 |
| - permissions: |
11 |
| - contents: write |
12 |
| - pull-requests: write |
13 |
| - repository-projects: write |
14 | 60 | if: github.actor == 'dependabot[bot]'
|
15 | 61 | steps:
|
16 | 62 | - name: Dependabot metadata
|
|
0 commit comments