| 1 | name: (Compiler) Publish Prereleases |
| 2 | |
| 3 | on: |
| 4 | workflow_call: |
| 5 | inputs: |
| 6 | commit_sha: |
| 7 | required: true |
| 8 | default: '' |
| 9 | type: string |
| 10 | release_channel: |
| 11 | required: true |
| 12 | type: string |
| 13 | dist_tag: |
| 14 | required: true |
| 15 | type: string |
| 16 | version_name: |
| 17 | required: true |
| 18 | type: string |
| 19 | tag_version: |
| 20 | required: false |
| 21 | type: string |
| 22 | dry_run: |
| 23 | required: false |
| 24 | type: boolean |
| 25 | secrets: |
| 26 | NPM_TOKEN: |
| 27 | required: true |
| 28 | |
| 29 | permissions: {} |
| 30 | |
| 31 | env: |
| 32 | TZ: /usr/share/zoneinfo/America/Los_Angeles |
| 33 | # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout |
| 34 | SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 |
| 35 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 36 | |
| 37 | defaults: |
| 38 | run: |
| 39 | working-directory: compiler |
| 40 | |
| 41 | jobs: |
| 42 | publish_prerelease: |
| 43 | name: Publish prelease (${{ inputs.release_channel }}) ${{ inputs.commit_sha }} @${{ inputs.dist_tag }} |
| 44 | runs-on: ubuntu-latest |
| 45 | steps: |
| 46 | - uses: actions/checkout@v4 |
| 47 | - uses: actions/setup-node@v4 |
| 48 | with: |
| 49 | node-version-file: '.nvmrc' |
| 50 | - name: Cache node_modules |
| 51 | uses: actions/cache@v4 |
| 52 | id: node_modules |
| 53 | with: |
| 54 | path: | |
| 55 | **/node_modules |
| 56 | key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/yarn.lock') }} |
| 57 | - run: yarn install --frozen-lockfile |
| 58 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 59 | - if: inputs.dry_run == true |
| 60 | name: Publish packages to npm (dry run) |
| 61 | run: | |
| 62 | cp ./scripts/release/ci-npmrc ~/.npmrc |
| 63 | scripts/release/publish.js --frfr --debug --ci --versionName=${{ inputs.version_name }} --tag=${{ inputs.dist_tag }} ${{ inputs.tag_version && format('--tagVersion={0}', inputs.tag_version) || '' }} |
| 64 | - if: inputs.dry_run != true |
| 65 | name: Publish packages to npm |
| 66 | run: | |
| 67 | cp ./scripts/release/ci-npmrc ~/.npmrc |
| 68 | scripts/release/publish.js --frfr --ci --versionName=${{ inputs.version_name }} --tag=${{ inputs.dist_tag }} ${{ inputs.tag_version && format('--tagVersion={0}', inputs.tag_version) || '' }} |