Remove components dependencies from end result #8
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
name: Build and Upload Artifact | |
on: | |
push: | |
branches: | |
- main # Adjust the branch name if needed | |
jobs: | |
read-package-json: | |
runs-on: ubuntu-latest | |
outputs: | |
package_version: ${{ steps.save_output.outputs.version}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Read package.json | |
id: save_output | |
run: | | |
echo "version=$(jq -r '.version' package.json)" >> "$GITHUB_OUTPUT" | |
create-github-release: | |
needs: [read-package-json] | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.save_output.outputs.upload_url }} | |
release_id: ${{ steps.save_output.outputs.release_id }} | |
steps: | |
- name: Delete all releases | |
uses: larryjoelane/[email protected] | |
with: | |
release-name: ${{ needs.read-package-json.outputs.package_version }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.read-package-json.outputs.package_version}} | |
release_name: Release ${{ needs.read-package-json.outputs.package_version}} | |
body: | | |
Release of the Discord Package for the Grid Editor | |
draft: false | |
prerelease: false | |
- name: Save release output | |
id: save_output | |
run: | | |
echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> "$GITHUB_OUTPUT" | |
echo "release_id=${{ steps.create_release.outputs.id }}" >> "$GITHUB_OUTPUT" | |
build: | |
runs-on: ${{ matrix.os }} | |
needs: create-github-release | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
# os: [macos-latest] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 # Specify the desired Node.js version | |
- name: Install dependencies | |
run: npm install | |
- name: Build components | |
run: | | |
cd components | |
npm install | |
npm run build | |
- name: Install archiver package | |
run: npm install archiver | |
- name: Run build script | |
run: node build.js | |
- name: Upload Artifact | |
uses: tanyagray/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-github-release.outputs.upload_url }} | |
asset_path: package-archive.zip | |
asset_name: package-discord-${{ matrix.os }}.zip | |
asset_content_type: application/zip | |
publish-release: | |
needs: [build, create-github-release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Publish Release | |
uses: eregon/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ needs.create-github-release.outputs.release_id}} |