ci(create-release): use github app token

This commit is contained in:
ANTOND.
2025-05-04 01:50:09 +02:00
parent ce8a1ba50b
commit a9728663ca
3 changed files with 43 additions and 45 deletions

View File

@@ -7,26 +7,39 @@ on:
jobs:
create-release:
if: github.actor_id != 210085057
runs-on: ubuntu-latest
steps:
- name: Get latest code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}
- name: Install zip
run: sudo apt install zip
- name: Setup Bun
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Generate GitHub App token
id: app_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Get latest code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}
token: ${{ steps.app_token.outputs.token }}
- name: Install package dependencies
run: bun install
run: bun install --frozen-lockfile
working-directory: package
- name: Install web dependencies
run: bun install
run: bun install --frozen-lockfile
working-directory: web
- name: Run web build script
@@ -35,16 +48,15 @@ jobs:
- name: Bump package version
run: bun .github/actions/bump-package-version.js
run: bun run .github/actions/bump-package-version.js
env:
TGT_RELEASE_VERSION: ${{ github.ref_name }}
- name: Bump manifest version
run: bun .github/actions/bump-manifest-version.js
run: bun run .github/actions/bump-manifest-version.js
env:
TGT_RELEASE_VERSION: ${{ github.ref_name }}
- name: Push version bump change
uses: EndBug/add-and-commit@v9
with:
@@ -53,25 +65,10 @@ jobs:
default_author: github_actions
message: 'chore: bump version to ${{ github.ref_name }}'
- name: Update tag
uses: EndBug/latest-tag@v1
with:
ref: ${{ github.ref_name }}
- name: Publish package to npm registry
run: bun publish --access public
working-directory: package
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install zip
run: sudo apt install zip
- name: Bundle files
run: |
mkdir -p ./temp/ox_lib
mkdir -p ./temp/ox_lib/web/
mkdir -p ./temp/ox_lib/web
cp ./{LICENSE,README.md,fxmanifest.lua,init.lua} ./temp/ox_lib
cp -r ./{imports,resource,locales} ./temp/ox_lib
cp -r ./web/build ./temp/ox_lib/web/
@@ -79,11 +76,18 @@ jobs:
- name: Create release
uses: 'marvinpinto/action-automatic-releases@v1.2.1'
id: auto_release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
files: ox_lib.zip
- name: Update tag
uses: EndBug/latest-tag@v1
with:
ref: ${{ github.ref_name }}
- name: Publish package to npm registry
run: bun publish --access public
working-directory: package
env:
CI: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}