Skip to content

Commit

Permalink
New Build Script
Browse files Browse the repository at this point in the history
  • Loading branch information
domi-btnr committed Aug 28, 2024
1 parent 3413d0a commit 1dba5e2
Show file tree
Hide file tree
Showing 8 changed files with 355 additions and 471 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Autobuild Plugins

on:
push:
branches:
- development
workflow_dispatch:
inputs:
plugin:
description: What plugin to build. Omit for all.
required: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Compile Plugins
runs-on: ubuntu-latest

steps:
- name: Clean working directory
run: rm -rf /home/runner/work/${{ github.repository }}

- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install dependencies
run: npm install --no-audit --no-fund

- name: Detect changed files
id: files
if: "github.event_name == 'push'"
uses: jitterbit/get-changed-files@v1
continue-on-error: true

- name: Build plugins
run: >-
npm run build --
--publish
--plugins ${{ github.event.inputs.plugin }}
${{ steps.files.outputs.all }}
&& if [ ! -d builds ]; then echo "noBuildFolder=true" >> $GITHUB_ENV; fi
- name: Cancel Job when no Artifact
if: "env.noBuildFolder == 'true'"
uses: andymckay/[email protected]

- name: Stage build
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: builds
retention-days: 1

publish:
name: Publish plugins
runs-on: ubuntu-latest
needs: build

steps:
- name: Restore repo
uses: actions/checkout@v4
with:
ref: main

- name: Apply build
uses: actions/download-artifact@v4
with:
name: build-artifact

- name: Commit
run: |
git config advice.addIgnoredFile false
git add --no-all ./**
git config --local user.email "[email protected]"
git config --local user.name "PluginBuilder"
git commit -m "Publish build" || true
- name: Push
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: master
98 changes: 0 additions & 98 deletions .github/workflows/main.yml

This file was deleted.

110 changes: 0 additions & 110 deletions .github/workflows/run-bdbuilder

This file was deleted.

4 changes: 3 additions & 1 deletion InvisibleTyping/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
{
"title": "Fixed",
"type": "fixed",
"items": ["The Plugin works again"]
"items": [
"The Plugin works again"
]
}
],
"changelogDate": "2024-08-29"
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "Some useful Discord-Addons for BetterDiscord.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "node scripts/new-builder.js"
"build": "node scripts/build.js"
},
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 1dba5e2

Please sign in to comment.