|
| 1 | +name: Release Please |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pull-requests: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + release-please: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + release_created: ${{ steps.release.outputs.release_created }} |
| 17 | + tag_name: ${{ steps.release.outputs.tag_name }} |
| 18 | + steps: |
| 19 | + - uses: googleapis/release-please-action@v4 |
| 20 | + id: release |
| 21 | + with: |
| 22 | + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} |
| 23 | + release-type: node |
| 24 | + |
| 25 | + build-and-release: |
| 26 | + needs: release-please |
| 27 | + if: ${{ needs.release-please.outputs.release_created }} |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v5 |
| 31 | + |
| 32 | + - uses: pnpm/action-setup@v4 |
| 33 | + with: |
| 34 | + version: 9 |
| 35 | + |
| 36 | + - uses: actions/setup-node@v4 |
| 37 | + with: |
| 38 | + node-version: 24 |
| 39 | + cache: 'pnpm' |
| 40 | + |
| 41 | + - name: Install dependencies |
| 42 | + run: pnpm install |
| 43 | + |
| 44 | + - name: Build plugin |
| 45 | + run: pnpm run build |
| 46 | + |
| 47 | + - name: Create release package |
| 48 | + run: | |
| 49 | + VERSION="${{ needs.release-please.outputs.tag_name }}" |
| 50 | + VERSION="${VERSION#v}" # Remove 'v' prefix if present |
| 51 | + RELEASE_DIR="LetUsReShade" |
| 52 | + ZIP_NAME="LetUsReShade_v${VERSION}.zip" |
| 53 | +
|
| 54 | + # Create temporary directory structure |
| 55 | + mkdir -p "${RELEASE_DIR}" |
| 56 | +
|
| 57 | + # Copy necessary files |
| 58 | + cp -r dist "${RELEASE_DIR}/" |
| 59 | + cp -r defaults "${RELEASE_DIR}/" |
| 60 | + cp main.py "${RELEASE_DIR}/" |
| 61 | + cp package.json "${RELEASE_DIR}/" |
| 62 | + cp plugin.json "${RELEASE_DIR}/" |
| 63 | + cp LICENSE "${RELEASE_DIR}/" |
| 64 | + cp README.md "${RELEASE_DIR}/" |
| 65 | +
|
| 66 | + # Create zip file |
| 67 | + zip -r "${ZIP_NAME}" "${RELEASE_DIR}" |
| 68 | +
|
| 69 | + echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV |
| 70 | +
|
| 71 | + - name: Upload release asset |
| 72 | + env: |
| 73 | + GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} |
| 74 | + run: | |
| 75 | + gh release upload ${{ needs.release-please.outputs.tag_name }} \ |
| 76 | + "${ZIP_NAME}" \ |
| 77 | + --repo ${{ github.repository }} |
0 commit comments