-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add minify step to release action
- Loading branch information
1 parent
f3f7ef7
commit 1b1c342
Showing
3 changed files
with
97 additions
and
40 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: minify | ||
|
||
inputs: | ||
package: | ||
description: Selected package to minify | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set PACKAGE | ||
shell: bash | ||
run: | | ||
echo "PACKAGE=$(echo ${{ inputs.package }} | sed 's/@inworld\///g')" >> $GITHUB_ENV | ||
- name: Extract version | ||
shell: bash | ||
run: | | ||
echo "VERSION=$(node -e "console.log(require('./packages/${{ env.PACKAGE }}/package.json').version)")" >> $GITHUB_ENV | ||
id: extract-version | ||
|
||
- name: Set OUTPUT | ||
shell: bash | ||
run: | | ||
echo "OUTPUT=packages/${{ env.PACKAGE }}/dist/inworld-${{ env.PACKAGE }}-${{ env.VERSION }}.min.js" >> $GITHUB_ENV | ||
- name: Minify | ||
shell: bash | ||
run: | | ||
npx yarn workspace ${{ inputs.package }} minify | ||
- name: Authenticate to Google Cloud | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
workload_identity_provider: ${{ env.AUTH_IDENTITY_PROVIDER }} | ||
service_account: ${{ env.AUTH_SERVICE_ACCOUNT }} | ||
create_credentials_file: true | ||
|
||
- name: Rename minified file | ||
shell: bash | ||
run: | | ||
mv packages/${{ env.PACKAGE }}/dist/inworld-${{ env.PACKAGE }}.min.js ${{ env.OUTPUT }} | ||
- name: Upload to GCS | ||
uses: 'google-github-actions/upload-cloud-storage@v2' | ||
with: | ||
path: ${{ env.OUTPUT }} | ||
destination: 'innequin-assets/packages' |
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
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 |
---|---|---|
|
@@ -18,6 +18,10 @@ on: | |
- '@inworld/web-core' | ||
- '@inworld/web-threejs' | ||
|
||
env: | ||
AUTH_SERVICE_ACCOUNT: [email protected] | ||
AUTH_IDENTITY_PROVIDER: projects/678423885598/locations/global/workloadIdentityPools/github-devops-pool/providers/github-prvdr | ||
|
||
jobs: | ||
github-release: | ||
runs-on: ubuntu-latest | ||
|
@@ -55,6 +59,29 @@ jobs: | |
- name: Publish to npm | ||
run: npx yarn workspace ${{ inputs.package }} release:publish | ||
|
||
minify-and-upload: | ||
runs-on: [self-hosted, linux, x64, kubernetes, ephemeral] | ||
needs: [npm-release] | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
- name: Run build | ||
uses: ./.github/actions/build_package | ||
with: | ||
mode: 'prod' | ||
- name: Minify and upload | ||
uses: ./.github/actions/minify | ||
with: | ||
package: ${{ inputs.package }} | ||
env: | ||
AUTH_SERVICE_ACCOUNT: ${{ env.AUTH_SERVICE_ACCOUNT }} | ||
AUTH_IDENTITY_PROVIDER: ${{ env.AUTH_IDENTITY_PROVIDER }} | ||
|
||
release-notification: | ||
runs-on: [self-hosted, kubernetes, nodocker] | ||
needs: [github-release, npm-release] | ||
|