Release #125
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
required: true | |
type: string | |
jobs: | |
get_release_info_job: | |
name: Get Release Info | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ env.version }} | |
release_upload_url: ${{ steps.create_release.outputs.upload_url }} | |
tag_name: ${{ env.tag_name }} | |
release_id: ${{ steps.create_release.outputs.id }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: get_release_info | |
name: Get Release Info | |
shell: bash | |
run: | | |
version="${{ inputs.version }}" | |
tagName="release-v$version" | |
releaseName="Release $version" | |
echo "Version: $version" | |
echo "Tag Name: $tagName" | |
echo "version=$version" >> $GITHUB_ENV | |
echo "tag_name=$tagName" >> $GITHUB_ENV | |
echo "release_name=$releaseName" >> $GITHUB_ENV | |
- name: Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ env.tag_name }} | |
name: ${{ env.tag_name }} | |
draft: false | |
prerelease: false | |
make_latest: true | |
release_windows_job: | |
name: Release Windows | |
runs-on: windows-2019 | |
needs: get_release_info_job | |
steps: | |
- name: Print Debug Info | |
shell: bash | |
run: | | |
echo "Version: ${{ needs.get_release_info_job.outputs.version }}" | |
echo "Release Upload URL: ${{ needs.get_release_info_job.outputs.release_upload_url }}" | |
echo "Release ID: ${{ needs.get_release_info_job.outputs.release_id }}" | |
- uses: actions/checkout@v4 | |
- id: get_this_release_info | |
shell: bash | |
run: | | |
artifactPath="FBX-glTF-conv-${{ needs.get_release_info_job.outputs.version }}-win32.tar.gz" | |
echo "artifactPath=$artifactPath" >> $GITHUB_ENV | |
- id: build | |
name: Build | |
run: CI/build.sh -Version "${{ needs.get_release_info_job.outputs.version }}" -ArtifactPath "${{ env.artifactPath }}" | |
shell: bash | |
- name: Upload to Release | |
uses: svenstaro/[email protected] | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.artifactPath }} | |
asset_name: ${{ env.artifactPath }} | |
tag: ${{ needs.get_release_info_job.outputs.tag_name }} | |
release_darwin_job: | |
name: Release MacOS | |
runs-on: macos-latest | |
needs: get_release_info_job | |
steps: | |
- name: Print Debug Info | |
shell: bash | |
run: | | |
echo "Version: ${{ needs.get_release_info_job.outputs.version }}" | |
echo "Release Upload URL: ${{ needs.get_release_info_job.outputs.release_upload_url }}" | |
echo "Release ID: ${{ needs.get_release_info_job.outputs.release_id }}" | |
- uses: actions/checkout@v4 | |
- id: get_this_release_info | |
run: | | |
osName=$(uname | tr '[:upper:]' '[:lower:]') | |
artifactPath="FBX-glTF-conv-${{ needs.get_release_info_job.outputs.version }}-$osName.tar.gz" | |
echo "artifactPath=$artifactPath" >> $GITHUB_ENV | |
- id: build | |
name: Build | |
run: CI/build.sh -Version "${{ needs.get_release_info_job.outputs.version }}" -ArtifactPath "${{ env.artifactPath }}" | |
- name: Upload to Release | |
uses: svenstaro/[email protected] | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.artifactPath }} | |
asset_name: ${{ env.artifactPath }} | |
tag: ${{ needs.get_release_info_job.outputs.tag_name }} | |
release_types_job: | |
name: Release TypeScript Declaration Files | |
runs-on: ubuntu-latest | |
needs: get_release_info_job | |
steps: | |
- name: Print Debug Info | |
run: | | |
echo "Version: ${{ needs.get_release_info_job.outputs.version }}" | |
echo "Release Upload URL: ${{ needs.get_release_info_job.outputs.release_upload_url }}" | |
echo "Release ID: ${{ needs.get_release_info_job.outputs.release_id }}" | |
- uses: actions/checkout@v4 | |
- id: get_this_release_info | |
run: | | |
artifactPath="FBX-glTF-conv-${{ needs.get_release_info_job.outputs.version }}-types.tar.gz" | |
echo "artifactPath=$artifactPath" >> $GITHUB_ENV | |
- id: build | |
name: Build | |
run: tar -czvf "${{ env.artifactPath }}" -C types . | |
shell: bash | |
- name: Upload to Release | |
uses: svenstaro/[email protected] | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.artifactPath }} | |
asset_name: ${{ env.artifactPath }} | |
tag: ${{ needs.get_release_info_job.outputs.tag_name }} | |
publish_to_npm_job: | |
name: Publish to NPM | |
runs-on: ubuntu-latest | |
needs: [get_release_info_job, release_windows_job, release_darwin_job, release_types_job] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Show release id | |
run: echo ${{ needs.get_release_info_job.outputs.release_id }} | |
- name: Download artifact | |
id: download-artifact | |
uses: robinraju/release-downloader@v1 | |
with: | |
releaseId: ${{ needs.get_release_info_job.outputs.release_id }} | |
fileName: '*' | |
tarBall: true | |
zipBall: false | |
extract: true | |
- name: Show downloaded files | |
run: | | |
ls -la | |
tree Release | |
- name: Copy files to publish directory | |
run: | | |
mkdir -p publish/bin/darwin | |
mkdir -p publish/bin/win32 | |
mkdir -p publish/types | |
ls -l publish/ | |
cp Release/bin/FBX-glTF-conv publish/bin/darwin | |
cp Release/bin/FBX-glTF-conv.exe publish/bin/win32 | |
cp types/FBX-glTF-conv-extras.d.ts publish/types | |
- name: npm ci & npm run build | |
run: | | |
cd publish | |
npm ci | |
npm run build | |
tree . | |
- name: Modify package.json and VERSION | |
run: | | |
cd publish | |
sed -i "s/\"version\": \".*\"/\"version\": \"${{ needs.get_release_info_job.outputs.version }}\"/g" package.json | |
sed -i "s/\"version\": \".*\"/\"version\": \"${{ needs.get_release_info_job.outputs.version }}\"/g" package-lock.json | |
echo "${{ needs.get_release_info_job.outputs.version }}" > VERSION | |
- uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_PUBLISH_FOR_PUBLIC_REPO }} | |
registry: "https://registry.npmjs.org" | |
package: publish |