-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
84 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,92 +1,51 @@ | ||
name: Release | ||
name: Build and Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
- 'v*.*.*' # This triggers the workflow on version tags | ||
|
||
jobs: | ||
create-release: | ||
name: Build and Create Tagged Release | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install archive tools | ||
run: sudo apt install zip | ||
|
||
- name: Checkout source code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.repository.default_branch }} | ||
|
||
- uses: pnpm/[email protected] | ||
with: | ||
version: 8.6.1 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 21.x | ||
cache: 'pnpm' | ||
cache-dependency-path: 'web/pnpm-lock.yaml' | ||
|
||
- name: Set env | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
working-directory: web | ||
|
||
- name: Install package dependencies | ||
run: pnpm install | ||
working-directory: package | ||
|
||
- name: Bump package version | ||
run: pnpm version ${{ github.ref_name }} | ||
working-directory: package | ||
|
||
- name: Run build | ||
run: pnpm build | ||
working-directory: web | ||
env: | ||
CI: false | ||
|
||
- name: Bump manifest version | ||
run: node .github/actions/bump-manifest-version.js | ||
env: | ||
TGT_RELEASE_VERSION: ${{ github.ref_name }} | ||
|
||
- name: Push manifest change | ||
uses: EndBug/add-and-commit@v8 | ||
with: | ||
add: fxmanifest.lua | ||
push: true | ||
author_name: Manifest Bumper | ||
author_email: 41898282+github-actions[bot]@users.noreply.github.com | ||
message: 'chore: bump manifest version to ${{ github.ref_name }}' | ||
|
||
- name: Update tag ref | ||
uses: EndBug/latest-tag@latest | ||
with: | ||
tag-name: ${{ github.ref_name }} | ||
|
||
- name: Bundle files | ||
run: | | ||
mkdir -p ./temp/mm_radio | ||
mkdir -p ./temp/mm_radio/web/ | ||
cp ./{LICENSE,README.md,fxmanifest.lua,init.lua} ./temp/mm_radio | ||
cp -r ./{imports,resource,locales} ./temp/mm_radio | ||
cp -r ./web/build ./temp/mm_radio/web/ | ||
cd ./temp && zip -r ../mm_radio.zip ./mm_radio | ||
- name: Create Release | ||
uses: 'marvinpinto/[email protected]' | ||
id: auto_release | ||
with: | ||
repo_token: '${{ secrets.GITHUB_TOKEN }}' | ||
prerelease: false | ||
files: mm_radio.zip | ||
|
||
env: | ||
CI: false | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '21.1.0' # Using Node.js version 21.1.0 | ||
|
||
- name: Install dependencies | ||
run: npm install --prefix web # Install dependencies in the web folder | ||
|
||
- name: Build Svelte project | ||
run: npm run build --prefix web # Run build script in the web folder | ||
|
||
- name: Zip build folder | ||
run: | | ||
cd web | ||
zip -r ../mm_radio.zip public/ # Zip the contents of the build output | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} # Use the tag name as the release title | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./mm_radio.zip # Path to the zip file | ||
asset_name: mm_radio.zip # Name of the asset | ||
asset_content_type: application/zip |