|
| 1 | +name: Release |
| 2 | + |
| 3 | +"on": |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + release_tag: |
| 7 | + description: The version to release starting with `v` |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + release_ref: |
| 11 | + description: The branch, tag or SHA to checkout (default to latest) |
| 12 | + default: "" |
| 13 | + type: string |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: write |
| 17 | + |
| 18 | +jobs: |
| 19 | + publish-package: |
| 20 | + name: Publish package |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Enable corepack |
| 26 | + run: corepack enable |
| 27 | + |
| 28 | + - uses: actions/setup-node@v3 |
| 29 | + with: |
| 30 | + node-version: latest |
| 31 | + registry-url: https://registry.npmjs.org |
| 32 | + cache: yarn |
| 33 | + cache-dependency-path: yarn.lock |
| 34 | + |
| 35 | + - name: Install packages |
| 36 | + run: yarn install --immutable |
| 37 | + |
| 38 | + - name: Run npmluau |
| 39 | + run: yarn run prepare |
| 40 | + |
| 41 | + - name: Authenticate yarn |
| 42 | + run: |- |
| 43 | + yarn config set npmAlwaysAuth true |
| 44 | + yarn config set npmAuthToken $NPM_AUTH_TOKEN |
| 45 | + env: |
| 46 | + NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 47 | + |
| 48 | + - name: Publish to npm |
| 49 | + run: yarn npm publish --access public |
| 50 | + |
| 51 | + publish-wally-package: |
| 52 | + needs: publish-package |
| 53 | + |
| 54 | + name: Publish wally package |
| 55 | + runs-on: ubuntu-latest |
| 56 | + |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - uses: Roblox/setup-foreman@v1 |
| 61 | + with: |
| 62 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + |
| 64 | + - name: Enable corepack |
| 65 | + run: corepack enable |
| 66 | + |
| 67 | + - uses: actions/setup-node@v3 |
| 68 | + with: |
| 69 | + node-version: "latest" |
| 70 | + cache: "yarn" |
| 71 | + cache-dependency-path: "yarn.lock" |
| 72 | + |
| 73 | + - name: Install packages |
| 74 | + run: yarn install --immutable |
| 75 | + |
| 76 | + - name: Run npmluau |
| 77 | + run: yarn run prepare |
| 78 | + |
| 79 | + - name: Build artifacts |
| 80 | + run: yarn run build |
| 81 | + |
| 82 | + - name: Login to wally |
| 83 | + run: wally login --project-path build/wally --token ${{ secrets.WALLY_ACCESS_TOKEN }} |
| 84 | + |
| 85 | + - name: Publish to wally |
| 86 | + run: wally publish --project-path build/wally |
| 87 | + |
| 88 | + create-release: |
| 89 | + needs: publish-package |
| 90 | + name: Create release |
| 91 | + runs-on: ubuntu-latest |
| 92 | + outputs: |
| 93 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 94 | + steps: |
| 95 | + - uses: actions/checkout@v4 |
| 96 | + |
| 97 | + - name: Create tag |
| 98 | + run: | |
| 99 | + git fetch --tags --no-recurse-submodules |
| 100 | + if [ ! $(git tag -l ${{ inputs.release_tag }}) ]; then |
| 101 | + git tag ${{ inputs.release_tag }} |
| 102 | + git push origin ${{ inputs.release_tag }} |
| 103 | + fi |
| 104 | +
|
| 105 | + - name: Create release |
| 106 | + id: create_release |
| 107 | + uses: softprops/action-gh-release@v1 |
| 108 | + env: |
| 109 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 110 | + with: |
| 111 | + tag_name: ${{ inputs.release_tag }} |
| 112 | + name: ${{ inputs.release_tag }} |
| 113 | + draft: false |
| 114 | + |
| 115 | + build-assets: |
| 116 | + needs: create-release |
| 117 | + name: Add assets |
| 118 | + runs-on: ubuntu-latest |
| 119 | + strategy: |
| 120 | + fail-fast: false |
| 121 | + matrix: |
| 122 | + include: |
| 123 | + - artifact-name: react-testing-library.rbxm |
| 124 | + path: build/react-testing-library.rbxm |
| 125 | + asset-type: application/octet-stream |
| 126 | + |
| 127 | + - artifact-name: react-testing-library-dev.rbxm |
| 128 | + path: build/debug/react-testing-library.rbxm |
| 129 | + asset-type: application/octet-stream |
| 130 | + steps: |
| 131 | + - uses: actions/checkout@v4 |
| 132 | + |
| 133 | + - uses: Roblox/setup-foreman@v1 |
| 134 | + with: |
| 135 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 136 | + |
| 137 | + - name: Enable corepack |
| 138 | + run: corepack enable |
| 139 | + |
| 140 | + - uses: actions/setup-node@v3 |
| 141 | + with: |
| 142 | + node-version: latest |
| 143 | + registry-url: https://registry.npmjs.org |
| 144 | + cache: yarn |
| 145 | + cache-dependency-path: yarn.lock |
| 146 | + |
| 147 | + - name: Install packages |
| 148 | + run: yarn install --immutable |
| 149 | + |
| 150 | + - name: Run npmluau |
| 151 | + run: yarn run prepare |
| 152 | + |
| 153 | + - name: Build assets |
| 154 | + run: yarn run build |
| 155 | + |
| 156 | + - name: Upload asset |
| 157 | + uses: actions/upload-artifact@v3 |
| 158 | + with: |
| 159 | + name: ${{ matrix.artifact-name }} |
| 160 | + path: ${{ matrix.path }} |
| 161 | + |
| 162 | + - name: Add asset to Release |
| 163 | + uses: actions/upload-release-asset@v1 |
| 164 | + env: |
| 165 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 166 | + with: |
| 167 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 168 | + asset_path: ${{ matrix.path }} |
| 169 | + asset_name: ${{ matrix.artifact-name }} |
| 170 | + asset_content_type: ${{ matrix.asset-type }} |
0 commit comments