-
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 ea2e677
Showing
5 changed files
with
116 additions
and
45 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
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,72 @@ | ||
name: minify | ||
|
||
inputs: | ||
package: | ||
description: Selected package to minify | ||
required: true | ||
tag: | ||
description: Tag to checkout | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Create tmp folder | ||
shell: bash | ||
run: mkdir -p ./tmp | ||
|
||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.tag }} | ||
fetch-tags: true | ||
path: ./packages | ||
|
||
- name: Copy packages | ||
shell: bash | ||
run: cp -r ./tmp/packages/* ./packages | ||
|
||
- name: Run build | ||
uses: ./.github/actions/build_package | ||
with: | ||
mode: 'prod' | ||
|
||
- 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' | ||
process_gcloudignore: false |
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,28 @@ 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@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set TAG as the latest one | ||
run: echo "TAG=refs/tags/`echo $(git describe --tags --match="${{ inputs.package }}*" --abbrev=0)`" >> $GITHUB_ENV | ||
- name: Minify and upload | ||
uses: ./.github/actions/upload_minified_version | ||
with: | ||
package: ${{ inputs.package }} | ||
tag: ${{ env.TAG }} | ||
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] | ||
|
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