Skip to content

Commit

Permalink
Update plugin repo publish GH Actions config
Browse files Browse the repository at this point in the history
Update deprecated commands
Update deprecated actions
Use the repo gen action for building and publishing the repository
  • Loading branch information
Josh5 committed Sep 2, 2024
1 parent 81b13b7 commit 6d7e69b
Showing 1 changed file with 11 additions and 59 deletions.
70 changes: 11 additions & 59 deletions .github/workflows/plugin-repo-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -227,7 +227,7 @@ jobs:
run: echo 'true' > success_file.txt
- name: Upload success file
if: success()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: success_file
path: success_file.txt
Expand All @@ -239,76 +239,28 @@ jobs:
name: Build the plugin repository
steps:

# Fetch and read sucess file
# Fetch and read success file
- name: Download success file from previous job
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: ./artifacts/
- name: Read success file
id: previous_jobs_success
run: |
IS_SUCCESS=$(cat ./artifacts/success_file/success_file.txt)
echo ::set-output name=IS_SUCCESS::${IS_SUCCESS}
echo "IS_SUCCESS=${IS_SUCCESS:?}" >> $GITHUB_OUTPUT
rm -rfv ./artifacts
# Checkout
- name: Checkout
if: steps.previous_jobs_success.outputs.IS_SUCCESS == 'true'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

# Ensure repo is checked out
- name: Check repo for config file
if: success()
id: ensure_repo
run: |
if [ ! -e ./config.json ]; then
echo "Unable to build repo. Was not checked out."
exit 1
fi
# Import scripts from template branch
- name: Pull in scripts from template branch
if: success()
id: read_template_tree
run: |
git fetch origin template
git read-tree --prefix=template -u origin/template
cp -rf ./template/scripts ./
git rm -r --cached template
if [ ! -e ./scripts/generate_repository.py ]; then
echo "Unable to build repo. Could not find generator script."
exit 1
fi
# Setup python environment
- name: Set up Python 3.8
if: success()
uses: actions/setup-python@v4
with:
python-version: 3.8

# Setup node environment
- name: Set up node 16
uses: actions/setup-node@v3
# Execute plugin repo gen action
- name: Generate and Deploy Unmanic Plugin Repository
uses: Unmanic/action.generate-unmanic-plugin-repo@master
with:
node-version: '16'

# Generate repo
- name: Generate repository from source
if: success()
id: generate_repo
run: |
python ./scripts/generate_repository.py
# Deploy to repo branch
- name: Deploy repository
if: success() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/official')
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: repo
FOLDER: repo
SQUASH_HISTORY: true
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
deploy_repo: 'true'
github_token: ${{ secrets.GH_TOKEN }}

0 comments on commit 6d7e69b

Please sign in to comment.