This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
Update package.json #16
Workflow file for this run
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: Publish UPM Package | |
# Controls when the workflow will run | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [closed] | |
workflow_dispatch: | |
inputs: | |
run_manually: | |
description: 'Run Manually' | |
required: true | |
default: true | |
type: boolean | |
jobs: | |
convert_string: | |
name: Prepare String | |
runs-on: ubuntu-latest | |
outputs: | |
converted_string: ${{ steps.convertString.outputs.convertedString }} | |
steps: | |
- name: Set the original string | |
id: setOriginalString | |
run: echo "::set-output name=originalString::${{ github.event.repository.name }}" | |
- name: Convert string | |
id: convertString | |
run: | | |
ORIGINAL_STRING="${{ steps.setOriginalString.outputs.originalString }}" | |
IFS='-' read -ra PARTS <<< "$ORIGINAL_STRING" | |
RESULT="" | |
for PART in "${PARTS[@]}"; do | |
RESULT="${RESULT}$(echo "${PART^}")" | |
done | |
echo "::set-output name=convertedString::${RESULT}" | |
prepare: | |
needs: convert_string | |
name: Prepare | |
if: ${{ inputs.run_manually }} || github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Copy the README | |
run: | | |
cp "README.md" "Assets/${{ needs.convert_string.outputs.converted_string }}/README.md" | |
- name: Copy the LICENSE | |
run: | | |
cp "LICENSE" "Assets/${{ needs.convert_string.outputs.converted_string }}/LICENSE" | |
- name: Verify Changed files | |
uses: tj-actions/[email protected] | |
id: verify-changed-files | |
with: | |
files: | | |
**/README.md | |
**/LICENSE | |
- name: Commit files | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email ${{secrets.ADMIN_MAIL}} | |
git config --local user.name ${{secrets.ADMIN_NAME}} | |
git add . | |
git commit -m "Update README.md and LICENSE" -a | |
- name: Push changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
needs: | |
- convert_string | |
- prepare | |
name: Deploy | |
if: ${{ success() }} | |
runs-on: ubuntu-latest | |
steps: | |
# Any prerequisite steps | |
- name: Checkout latest | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: main | |
lfs: true | |
# Deploy to local repo | |
- name: Deploy | |
uses: s0/git-publish-subdir-action@develop | |
env: | |
REPO: self | |
BRANCH: upm | |
FOLDER: Assets/${{ needs.convert_string.outputs.converted_string }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SKIP_EMPTY_COMMITS: true | |
MESSAGE: "{msg}" |