Update package #4
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 package | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version number to check for draft release' | |
required: true | |
jobs: | |
update_versions: | |
permissions: | |
# write permission is required to create a github release | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v2 | |
with: | |
ref: 'master' | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Update version in package.json | |
run: | | |
jq '.version = "${{ github.event.inputs.version }}"' Package/package.json > temp.json && mv temp.json Package/package.json | |
- name: Replace specific line in readme.md | |
run: | | |
awk '{ if ($0 ~ /^https:\/\/github\.com\/crashkonijn\/GOAP\.git\?path=\/Package/) print "https://github.com/crashkonijn/GOAP.git?path=/Package#${{ github.event.inputs.version }}"; else print $0; }' readme.md > readme.tmp && mv readme.tmp readme.md | |
shell: bash | |
- name: Replace specific line in Package/Documentation/Introduction/GettingStarted.md | |
run: | | |
awk '{ if ($0 ~ /^https:\/\/github\.com\/crashkonijn\/GOAP\.git\?path=\/Package/) print "https://github.com/crashkonijn/GOAP.git?path=/Package#${{ github.event.inputs.version }}"; else print $0; }' Package/Documentation/Introduction/GettingStarted.md > readme.tmp && mv readme.tmp Package/Documentation/Introduction/GettingStarted.md | |
shell: bash | |
- name: Commit and push if there are changes | |
run: | | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git add Package/package.json | |
git add readme.md | |
git add Package/Documentation/Introduction/GettingStarted.md | |
# Check if there are any changes to commit | |
if git diff --staged --quiet; then | |
echo "No changes to commit." | |
else | |
git commit -m "Update version to ${{ github.event.inputs.version }}" | |
git push | |
fi | |
build_demo_files: | |
needs: | |
- update_versions | |
runs-on: ubuntu-latest | |
permissions: | |
# write permission is required to create a github release | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
cd Demo | |
echo "Assets/CrashKonijn.meta" > metaList | |
find Assets/CrashKonijn/ -name \*.meta >> metaList | |
echo "Contents of metaList:" | |
cat metaList | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
workflows: | |
- 'Demo/Assets/CrashKonijn/**' | |
- uses: crashkonijn/create-unitypackage@master | |
if: steps.filter.outputs.workflows == 'true' | |
with: | |
package-path: 'Package/Samples~/default/demo.unitypackage' | |
include-files: Demo/metaList | |
project-folder: 'Demo/' | |
- name: Commit and push | |
if: steps.filter.outputs.workflows == 'true' | |
run: | | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git add Package/Samples~/default/demo.unitypackage | |
git commit -m "Updated demo" | |
git push |