diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0286a9c2..cf918531 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,21 +7,13 @@ on: jobs: build: - name: Build and push + name: Build and release runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Checkout builds - uses: actions/checkout@v4 - with: - repository: "pyoncord/bunny-builds" - path: "builds" - token: ${{ secrets.BUILDS_TOKEN }} - ref: ${{ github.ref_name }} - - uses: actions/setup-node@v4 with: node-version: 20 @@ -36,18 +28,35 @@ jobs: # TODO: Check for linting? - - name: Push builds - run: | - rm $GITHUB_WORKSPACE/builds/* || true - cp -r dist/* $GITHUB_WORKSPACE/builds || true - cd $GITHUB_WORKSPACE/builds - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - git add . - git commit -m "Build $GITHUB_SHA" || exit 0 - git push - - - name: Purge CDN cache - run: | - curl https://purge.jsdelivr.net/gh/pyoncord/bunny-build-infos@${{ github.ref_name }}/bunny.js - + - name: Get file hash + id: hash + run: echo "hash=$GITHUB_SHA" >> "$GITHUB_OUTPUT" + + - name: Create draft release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.hash.outputs.hash }} + release_name: Revenge ${{ steps.hash.outputs.hash }} + draft: true + prerelease: false + + - name: Upload dist + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist/revenge.js + asset_name: revenge.js + asset_content_type: text/javascript + + - name: Publish release + uses: eregon/publish-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ steps.create_release.outputs.id }} + diff --git a/scripts/build.mjs b/scripts/build.mjs index 441ff138..5f4bf719 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -25,7 +25,7 @@ let context = null; const config = { entryPoints: ["src/entry.ts"], bundle: true, - outfile: "dist/bunny.js", + outfile: "dist/revenge.js", format: "iife", splitting: false, external: [], @@ -35,7 +35,7 @@ const config = { "const-and-let": false, }, footer: { - js: "//# sourceURL=bunny", + js: "//# sourceURL=revenge", }, loader: { ".png": "dataurl",