|
| 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 | + |
| 11 | + release_ref: |
| 12 | + description: "The branch, tag or SHA to checkout (default to latest)" |
| 13 | + default: "" |
| 14 | + type: string |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: write |
| 18 | + |
| 19 | +jobs: |
| 20 | + publish-package: |
| 21 | + name: Publish package |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - uses: actions/setup-node@v3 |
| 28 | + with: |
| 29 | + node-version: "latest" |
| 30 | + cache: "yarn" |
| 31 | + cache-dependency-path: "yarn.lock" |
| 32 | + |
| 33 | + - name: Install packages |
| 34 | + run: yarn install --frozen-lockfile |
| 35 | + |
| 36 | + - run: yarn publish |
| 37 | + env: |
| 38 | + NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 39 | + |
| 40 | + create-release: |
| 41 | + needs: publish-package |
| 42 | + |
| 43 | + name: Create release |
| 44 | + runs-on: ubuntu-latest |
| 45 | + |
| 46 | + outputs: |
| 47 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 48 | + |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v3 |
| 51 | + |
| 52 | + - name: Create tag |
| 53 | + run: | |
| 54 | + git fetch --tags --no-recurse-submodules |
| 55 | + if [ ! $(git tag -l ${{ inputs.release_tag }}) ]; then |
| 56 | + git tag ${{ inputs.release_tag }} |
| 57 | + git push origin ${{ inputs.release_tag }} |
| 58 | + fi |
| 59 | +
|
| 60 | + - name: Create release |
| 61 | + id: create_release |
| 62 | + uses: softprops/action-gh-release@v1 |
| 63 | + env: |
| 64 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + with: |
| 66 | + tag_name: ${{ inputs.release_tag }} |
| 67 | + name: ${{ inputs.release_tag }} |
| 68 | + draft: false |
| 69 | + |
| 70 | + build-assets: |
| 71 | + needs: create-release |
| 72 | + |
| 73 | + name: Add assets |
| 74 | + runs-on: ubuntu-latest |
| 75 | + |
| 76 | + strategy: |
| 77 | + fail-fast: false |
| 78 | + matrix: |
| 79 | + include: |
| 80 | + - artifact-name: signal.rbxm |
| 81 | + path: build/signal.rbxm |
| 82 | + asset-type: application/octet-stream |
| 83 | + |
| 84 | + - artifact-name: signal-dev.rbxm |
| 85 | + path: build/debug/signal.rbxm |
| 86 | + asset-type: application/octet-stream |
| 87 | + |
| 88 | + - artifact-name: signal-roblox-bundled.lua |
| 89 | + path: build/signal.lua |
| 90 | + asset-type: text/plain |
| 91 | + |
| 92 | + - artifact-name: signal-roblox-bundled-dev.lua |
| 93 | + path: build/debug/signal.lua |
| 94 | + asset-type: text/plain |
| 95 | + |
| 96 | + steps: |
| 97 | + - uses: actions/checkout@v4 |
| 98 | + |
| 99 | + - uses: Roblox/setup-foreman@v1 |
| 100 | + with: |
| 101 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 102 | + |
| 103 | + - uses: actions/setup-node@v3 |
| 104 | + with: |
| 105 | + node-version: "latest" |
| 106 | + cache: "yarn" |
| 107 | + cache-dependency-path: "yarn.lock" |
| 108 | + |
| 109 | + - name: Install packages |
| 110 | + run: yarn install --frozen-lockfile |
| 111 | + |
| 112 | + - name: Build assets |
| 113 | + run: yarn run build |
| 114 | + |
| 115 | + - name: Upload asset |
| 116 | + uses: actions/upload-artifact@v3 |
| 117 | + with: |
| 118 | + name: ${{ matrix.artifact-name }} |
| 119 | + path: ${{ matrix.path }} |
| 120 | + |
| 121 | + - name: Add asset to Release |
| 122 | + uses: actions/upload-release-asset@v1 |
| 123 | + env: |
| 124 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 125 | + with: |
| 126 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 127 | + asset_path: ${{ matrix.path }} |
| 128 | + asset_name: ${{ matrix.artifact-name }} |
| 129 | + asset_content_type: ${{ matrix.asset-type }} |
0 commit comments