diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb38e4c..8f95193 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,37 +1,50 @@ -name: Release +name: Automatic Release + on: push: - branches: [main, dev] + branches: + - main + workflow_dispatch: jobs: release: - name: Release + name: Create Release runs-on: ubuntu-latest permissions: contents: write steps: - - name: Checkout + - name: Checkout code uses: actions/checkout@v4 - - - name: Restore Bun cache - uses: actions/cache@v4 with: - path: ~/.bun/install/cache - key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} - restore-keys: | - ${{ runner.os }}-bun- + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - name: Setup Bun - uses: oven-sh/setup-bun@v2 + uses: oven-sh/setup-bun@v1 with: bun-version: latest - name: Install dependencies - run: bun install --frozen-lockfile + run: bun install - - name: Release - run: bunx semantic-release + - name: Extract bunny version + id: bunny_version + run: | + version=$(grep 'const version:' src/modules.d.ts | head -n1 | sed 's/[^0-9.]//g') + echo "version=$version" >> $GITHUB_OUTPUT + + - name: Build (if needed) + run: bun run build + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + tag_name: v${{ steps.bunny_version.outputs.version }} + name: Release v${{ steps.bunny_version.outputs.version }} + prerelease: ${{ github.ref == 'refs/heads/dev' }} + files: | + dist/shiggycord.js + dist/shiggycord.min.js env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_BRANCH: ${{ github.ref_name }}