This repository has been archived by the owner on Aug 24, 2024. It is now read-only.
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: | |
prepare: | |
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/${{ github.event.repository.name }}/README.md" | |
- name: Copy the LICENSE | |
run: | | |
cp "LICENSE" "Assets/${{ github.event.repository.name }}/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: | |
name: Deploy | |
if: ${{ success() }} | |
needs: prepare | |
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/${{ github.event.repository.name }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SKIP_EMPTY_COMMITS: true | |
MESSAGE: "{msg}" |