Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow publishing unity package on prerelease workflow #3310

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/templates/common.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,17 @@ with:
uses: #@ actionSetupXcode
with:
xcode-version: #@ version
#@ end
---
#@ def uploadToNpm(tag = "latest", versionExpression = "steps.get-version.outputs.version", expectShortPath = False):
#@ package = "io.realm.unity-${{" + versionExpression + "}}.tgz"
#@ pkgPath = "" if expectShortPath else package + "/"
- uses: #@ actionSetupNode
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: #@ "Npm Publish " + package
run: #@ "npm publish ${{ github.workspace }}/Realm/packages/" + pkgPath + package + " --tag " + tag
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
#@ end
3 changes: 2 additions & 1 deletion .github/templates/publish-prerelease.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#@ load("@ytt:template", "template")
#@ load("common.lib.yml", "checkoutCode", "downloadAllArtifacts", "readVersionFromPackage", "uploadPackagesToSleet")
#@ load("common.lib.yml", "checkoutCode", "downloadAllArtifacts", "readVersionFromPackage", "uploadPackagesToSleet", "uploadToNpm")

---
name: Publish Prerelease
Expand All @@ -13,3 +13,4 @@ jobs:
- #@ template.replace(downloadAllArtifacts("completed"))
- #@ template.replace(readVersionFromPackage())
- #@ template.replace(uploadPackagesToSleet())
- #@ template.replace(uploadToNpm("alpha"))
15 changes: 2 additions & 13 deletions .github/templates/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
#@ load("@ytt:template", "template")
#@ load("common.lib.yml", "checkoutCode", "actionSetupNode", "actionGithubRelease", "actionReleaseToSlack", "actionFindPR", "actionMergePR", "actionCreatePR", "mainBranch", "downloadAllArtifacts", "readVersionFromPackage", "configureAWSCredentials")
#@ load("common.lib.yml", "checkoutCode", "actionSetupNode", "actionGithubRelease", "actionReleaseToSlack", "actionFindPR", "actionMergePR", "actionCreatePR", "mainBranch", "downloadAllArtifacts", "readVersionFromPackage", "configureAWSCredentials", "uploadToNpm")

#@ def uploadToNuget(packageName):
- name: #@ "NuGet Publish " + packageName + ".${{ steps.get-version.outputs.version }}"
run: #@ "dotnet nuget push ${{ github.workspace }}/Realm/packages/" + packageName + ".${{ steps.get-version.outputs.version }}/" + packageName + ".${{ steps.get-version.outputs.version }}.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json"
#@ end

#@ def uploadToNpm(packageName):
- uses: #@ actionSetupNode
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: #@ "Npm Publish " + packageName + "-${{ steps.get-version.outputs.version }}"
run: #@ "npm publish ${{ github.workspace }}/Realm/packages/" + packageName + "-${{ steps.get-version.outputs.version }}.tgz/" + packageName + "-${{ steps.get-version.outputs.version }}.tgz"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
#@ end

#@ def publishGithubRelease():
- name: Publish Github Release
uses: #@ actionGithubRelease
Expand Down Expand Up @@ -108,7 +97,7 @@ jobs:
- #@ template.replace(uploadToNuget("Realm.SourceGenerator"))
- #@ template.replace(uploadToNuget("Realm.Fody"))
- #@ template.replace(uploadToNuget("Realm"))
- #@ template.replace(uploadToNpm("io.realm.unity"))
- #@ template.replace(uploadToNpm())
- #@ template.replace(mergeReleasePR())
- #@ template.replace(publishGithubRelease())
- #@ template.replace(updateChangelogForvNext())
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ jobs:
run: sleet push ${{ github.workspace }}/Realm/packages/Realm.${{ steps.get-version.outputs.version }}/Realm.${{ steps.get-version.outputs.version }}.nupkg --config ${{ github.workspace }}/.github/sleet.json --source NugetSource
- name: NuGet Publish Realm.SourceGenerator.${{ steps.get-version.outputs.version }}
run: sleet push ${{ github.workspace }}/Realm/packages/Realm.SourceGenerator.${{ steps.get-version.outputs.version }}/Realm.SourceGenerator.${{ steps.get-version.outputs.version }}.nupkg --config ${{ github.workspace }}/.github/sleet.json --source NugetSource
- uses: actions/setup-node@16352bb09bc672a073e326c2cc1d3d7d2a3e577e
with:
node-version: 16.x
registry-url: https://registry.npmjs.org
- name: Npm Publish io.realm.unity-${{steps.get-version.outputs.version}}.tgz
run: npm publish ${{ github.workspace }}/Realm/packages/io.realm.unity-${{steps.get-version.outputs.version}}.tgz/io.realm.unity-${{steps.get-version.outputs.version}}.tgz --tag alpha
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
run: dotnet nuget push ${{ github.workspace }}/Realm/packages/Realm.${{ steps.get-version.outputs.version }}/Realm.${{ steps.get-version.outputs.version }}.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- uses: actions/setup-node@16352bb09bc672a073e326c2cc1d3d7d2a3e577e
with:
node-version: 12.x
node-version: 16.x
registry-url: https://registry.npmjs.org
- name: Npm Publish io.realm.unity-${{ steps.get-version.outputs.version }}
run: npm publish ${{ github.workspace }}/Realm/packages/io.realm.unity-${{ steps.get-version.outputs.version }}.tgz/io.realm.unity-${{ steps.get-version.outputs.version }}.tgz
- name: Npm Publish io.realm.unity-${{steps.get-version.outputs.version}}.tgz
run: npm publish ${{ github.workspace }}/Realm/packages/io.realm.unity-${{steps.get-version.outputs.version}}.tgz/io.realm.unity-${{steps.get-version.outputs.version}}.tgz --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Find Release PR
Expand Down