Skip to content

Commit 171b200

Browse files
Merge pull request #563 from mcottontensor/backport/UE5.5/pr-552
[UE5.5] Merge pull request #552 from mcottontensor/changesets
2 parents 772c2b3 + 1ead85e commit 171b200

File tree

23 files changed

+4929
-4154
lines changed

23 files changed

+4929
-4154
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "master",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Publish NPM packages
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- 'UE*'
8+
paths:
9+
- '**/package.json'
10+
11+
concurrency: ${{ github.workflow }}-${{ github.ref }}
12+
13+
jobs:
14+
# gets all publishable npm packages.
15+
fetch-package-info:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
matrix: ${{ steps.query-packages.outputs.matrix }}
19+
steps:
20+
- name: Checkout Repo
21+
uses: actions/checkout@v3
22+
23+
- name: Get package info
24+
id: query-packages
25+
run: |
26+
# get all publishable npm packages
27+
public_packages=$(jq -r '.workspaces[]' package.json | xargs -I {} jq -c --arg path "{}" ' select(.private != true) | { path: $path, name: .name, version: .version }' {}/package.json)
28+
to_publish=()
29+
# filter out packages with older or matching versions to the published version
30+
for row in $public_packages; do
31+
package_name=$(echo $row | jq -r '.name')
32+
package_short_name=${package_name#@epicgames-ps/}
33+
package_version=$(echo $row | jq -r '.version')
34+
package_published=$(npm show "$package_name" version 2>/dev/null || echo "0.0.0")
35+
if [ "$(printf "%s\n%s" "$package_published" "$package_version" | sort -V | tail -n1)" = "$package_version" ] && [ "$package_version" != "$package_published" ]; then
36+
to_publish+=($(echo $row | jq -c ". + { \"tag\": \"${package_short_name}\" }"))
37+
fi
38+
done
39+
# change the list into a json list
40+
publish_json_list=[$(IFS=,; echo "${to_publish[*]}")]
41+
echo "matrix=$publish_json_list" >> $GITHUB_OUTPUT
42+
43+
44+
# actually publishes the npm package.
45+
publish:
46+
runs-on: ubuntu-latest
47+
needs: fetch-package-info
48+
permissions:
49+
contents: write
50+
strategy:
51+
max-parallel: 1
52+
matrix:
53+
package: ${{ fromJson(needs.fetch-package-info.outputs.matrix) }}
54+
steps:
55+
- name: Checkout Repo
56+
uses: actions/checkout@v3
57+
58+
- name: Get node version
59+
id: get_node_version
60+
run: echo "node_version=$(cat NODE_VERSION)" >> $GITHUB_OUTPUT
61+
62+
- name: Setup node
63+
uses: actions/setup-node@v4
64+
with:
65+
node-version: "${{ steps.get_node_version.outputs.node_version }}"
66+
registry-url: 'https://registry.npmjs.org'
67+
68+
- name: Publish ${{ matrix.package.name }}
69+
working-directory: ${{ matrix.package.path }}
70+
env:
71+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
72+
run: |
73+
npm install
74+
npm build
75+
npm publish --access public
76+
77+
- name: Build the version label
78+
id: build-label
79+
run: echo "label=${{ matrix.package.tag }}-${{ matrix.package.version }}" >> $GITHUB_OUTPUT
80+
81+
- name: Create release tag
82+
uses: actions/github-script@v5
83+
with:
84+
script: |
85+
github.rest.git.createRef({
86+
owner: context.repo.owner,
87+
repo: context.repo.repo,
88+
ref: 'refs/tags/${{ steps.build-label.outputs.label }}',
89+
sha: context.sha
90+
})
91+
92+
- name: Split up the archive paths so the path in the archives is nice.
93+
id: split-paths
94+
run: |
95+
echo "basename=$(basename ${{ matrix.package.path }})" >> $GITHUB_OUTPUT
96+
echo "dirname=$(dirname ${{ matrix.package.path }})" >> $GITHUB_OUTPUT
97+
98+
- name: Archive Release tar.gz
99+
uses: thedoctor0/zip-release@0.7.1
100+
with:
101+
directory: ${{ steps.split-paths.outputs.dirname }}
102+
path: ${{ steps.split-paths.outputs.basename }}
103+
type: 'tar'
104+
filename: '${{ steps.build-label.outputs.label }}.tar.gz'
105+
exclusions: >-
106+
node_modules
107+
108+
- name: Archive Release zip
109+
uses: thedoctor0/zip-release@0.7.1
110+
with:
111+
directory: ${{ steps.split-paths.outputs.dirname }}
112+
path: ${{ steps.split-paths.outputs.basename }}
113+
type: 'zip'
114+
filename: '${{ steps.build-label.outputs.label }}.zip'
115+
exclusions: >-
116+
/${{ steps.split-paths.outputs.basename }}/node_modules/*
117+
118+
- name: Make the release
119+
uses: ncipollo/release-action@v1
120+
with:
121+
tag: "${{ steps.build-label.outputs.label }}"
122+
artifacts: >
123+
${{ steps.split-paths.outputs.dirname }}/${{ steps.build-label.outputs.label }}.zip,
124+
${{ steps.split-paths.outputs.dirname }}/${{ steps.build-label.outputs.label }}.tar.gz
125+
bodyFile: ${{ matrix.package.path }}/CHANGELOG.md
126+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Update Changelogs
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- 'UE*'
8+
9+
concurrency: ${{ github.workflow }}-${{ github.ref }}
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
permissions:
16+
pull-requests: write
17+
steps:
18+
- name: Checkout Repo
19+
uses: actions/checkout@v3
20+
21+
- name: Setup Node.js 20.x
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 20.x
25+
26+
- name: Install Dependencies
27+
run: npm install
28+
29+
- name: Obtain the branch indicating the UE version
30+
id: extract-branch
31+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
32+
33+
- name: Create Release Pull Request
34+
uses: changesets/action@v1
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
37+
with:
38+
title: '[Bot] Update ${{ steps.extract-branch.outputs.branch }} NPM Changelogs'
39+
commit: 'Updated NPM changelogs'
40+

.github/workflows/publish-common-library-to-npm.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/publish-library-to-npm.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/publish-signalling-library-to-npm.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)