Skip to content

Publish Release

Publish Release #57

name: Publish Release
"on": workflow_dispatch
jobs:
main:
runs-on: windows-latest
environment: Production
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Download all artifacts
uses: dawidd6/action-download-artifact@46b4ae883bf0726f5949d025d31cb62c7a5ac70c
with:
workflow: pr.yml
commit: ${{ github.sha }}
path: ${{ github.workspace }}/Realm/packages/
workflow_conclusion: completed
- name: Read version
id: get-version
run: |
cd Realm/packages
pkgVersion=$(find . -type f -regex ".*Realm.[1-9].*.nupkg" -exec basename {} \; | sed -n 's/Realm\.\(.*\)\.nupkg$/\1/p')
echo "version=$pkgVersion" >> $GITHUB_OUTPUT
shell: bash
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.DOCS_S3_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.DOCS_S3_SECRET_KEY }}
aws-region: us-east-2
- name: Upload docs
run: |
Expand-Archive -Path Realm/packages/Docs.zip/Docs.zip -DestinationPath Realm/packages
$versions = "${{ steps.get-version.outputs.version }}", "latest"
Foreach ($ver in $versions)
{
aws s3 sync --acl public-read "${{ github.workspace }}\Realm\packages\_site" s3://realm-sdks/docs/realm-sdks/dotnet/$ver/
}
- name: NuGet Publish Realm.PlatformHelpers.${{ steps.get-version.outputs.version }}
run: dotnet nuget push ${{ github.workspace }}/Realm/packages/Realm.PlatformHelpers.${{ steps.get-version.outputs.version }}/Realm.PlatformHelpers.${{ steps.get-version.outputs.version }}.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- name: NuGet Publish Realm.${{ steps.get-version.outputs.version }}
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: 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 latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Find Release PR
uses: juliangruber/find-pull-request-action@afdd62ccd2d4c55f5bdb154b489b85fc4cbcb9c1
id: find-pull-request
with:
branch: ${{ github.ref }}
- name: Merge Pull Request
uses: juliangruber/merge-pull-request-action@333730196b34b74936aad75a4e31c23a57582d14
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.find-pull-request.outputs.number }}
method: squash
- name: Publish Github Release
uses: ncipollo/release-action@3ac4132803a6419fa2a7f4e9dbd1d93fceb690b9
with:
artifacts: Realm/packages/io.realm.unity-${{ steps.get-version.outputs.version }}.tgz/io.realm.unity-${{ steps.get-version.outputs.version }}.tgz
bodyFile: Realm/packages/ExtractedChangelog/ExtractedChangelog.md
name: ${{ steps.get-version.outputs.version }}
commit: main
tag: ${{ steps.get-version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
- name: Update Changelog
run: |
echo "## vNext (TBD)
### Enhancements
* None
### Fixed
* None
### Compatibility
* Realm Studio: 15.0.0 or later.
### Internal
* Using Core x.y.z.
" | cat - CHANGELOG.md >> temp
mv temp CHANGELOG.md
shell: bash
- name: Create vNext PR
id: vnext-pr
uses: peter-evans/create-pull-request@6c704eb7a8ba1daa13da0dcea9bb93a4fe530275
with:
branch: prepare-vnext
title: Prepare for vNext
body: Update Changelog for vNext
delete-branch: true
base: main
commit-message: Prepare for vNext
- name: Merge Pull Request
uses: juliangruber/merge-pull-request-action@333730196b34b74936aad75a4e31c23a57582d14
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.vnext-pr.outputs.pull-request-number }}
method: squash
- name: 'Post to #realm-releases'
uses: realm/ci-actions/release-to-slack@6418e15ed9bbdb19b7d456a347e5623779f95cdf
with:
changelog: Realm/packages/ExtractedChangelog/ExtractedChangelog.md
sdk: .NET
webhook-url: ${{ secrets.SLACK_RELEASE_WEBHOOK }}
version: ${{ steps.get-version.outputs.version }}