Merge pull request #1 from Studio-23-xyz/dev #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update and Publish UPM Branch | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
update-and-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set Git Config | |
run: | | |
git config --global user.email "tazimtazim2012@gmail.com" | |
git config --global user.name "Warhammer4000" | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Find package.json | |
id: find-package-json | |
run: echo ::set-output name=package-json-path::$(find . -name "package.json" | head -n 1) | |
- name: Get Package Name from package.json | |
id: get-package-name | |
run: echo ::set-output name=package-name::$(jq -r .name ${{ steps.find-package-json.outputs.package-json-path }}) | |
- name: Get Version from package.json | |
id: get-version | |
run: echo ::set-output name=version::$(jq -r .version ${{ steps.find-package-json.outputs.package-json-path }}) | |
- name: Git Subtree Split | |
run: git subtree split -P Assets/Packages/${{ steps.get-package-name.outputs.package-name }}/ -b upm | |
- name: Rename Samples | |
run: | | |
git checkout upm | |
if [[ -d "Samples" ]]; then | |
git mv Samples Samples~ | |
rm -f Samples.meta | |
git commit -am "fix: Samples => Samples~" | |
fi | |
- name: Create Git Tag | |
if: steps.get-version.outputs.version != '' | |
run: git tag v${{ steps.get-version.outputs.version }} upm | |
- name: Push Tags | |
run: | | |
git checkout upm | |
git push -f -u origin upm | |
git push --tags | |
SelfHosted-Publish: | |
needs: update-and-tag | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: upm | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
registry-url: ${{ secrets.NPM_SERVER }} | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
GitHub-Publish: | |
needs: update-and-tag | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: upm | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- uses: FrontEndDev-org/publish-node-package-action@v1 | |
with: | |
target: github |