forked from revenge-mod/revenge-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(build): use releases instead of pushing to repo
This build is identical to Bunny main's branch (as of the date this is pushed). This is to fix freezing issues on some devices.
- Loading branch information
Showing
1 changed file
with
38 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: [main, dev] | ||
paths-ignore: | ||
- "**/*.md" | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
build: | ||
name: Build and push | ||
name: Build and release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
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 }} | ||
- name: Set env | ||
id: env | ||
run: | | ||
echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | ||
echo "hash=$GITHUB_SHA" >> "$GITHUB_OUTPUT" | ||
- uses: actions/setup-node@v4 | ||
with: | ||
|
@@ -29,25 +28,35 @@ jobs: | |
- name: Install pnpm and dependencies | ||
run: | | ||
npm i -g pnpm | ||
pnpm i\ | ||
pnpm i | ||
- name: Build | ||
run: pnpm build --release-branch=${{ github.ref_name }} --build-minify | ||
|
||
# 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 "[email protected]" | ||
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: Create draft release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.env.outputs.tag }} | ||
release_name: Revenge ${{ steps.env.outputs.tag }} | ||
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 }} |