Update addons data #12
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 addons data | |
on: | |
workflow_dispatch: | |
inputs: | |
Version: | |
required: false | |
type: string | |
schedule: | |
- cron: 30 11/12 * * * | |
permissions: write-all | |
jobs: | |
update: | |
name: Update | |
runs-on: ubuntu-20.04 | |
steps: | |
# Clone | |
- uses: actions/[email protected] | |
with: | |
repository: ScratchAddons/ScratchAddons | |
sparse-checkout: | | |
addons/*/addon.json | |
addons/addons.json | |
sparse-checkout-cone-mode: false | |
fetch-tags: true | |
- run: ls -a | |
# Checkout | |
- run: VERSION="${{ inputs.Version || env.LATEST }}" | |
env: | |
LATEST: $(git rev-list --tags --timestamp --no-walk | sort -nr | head -n1 | cut -f 2 -d ' ') | |
- run: git checkout $VERSION | |
# Get package | |
- run: cd ../dist | |
- run: echo "{\"name\":\"@sa-community/addons-data\",\"version\":\"$VERSION\",\"description\":Scratch Addons" addons data\",\"homepage\":\"https://github.com/scratchaddons-community\",\"repository\":\"git+https://github.com/scratchaddons-community/addons-data-script\",\"license\":\"GPLv3\",\"maintainers\":[\"RedGuy12\"],\"main\":\"addons.json\"}' > package.json | |
# Get addons | |
- run: echo [ > addons.json | |
- run: addons = `jq -r '.[]' ../ScratchAddons/addons/addons.json` | |
- run: | | |
for addon in "${addons[@]}"; do | |
cat "../ScratchAddons/addons/$addon/addon.json" >> addons.json | |
echo , >> addons.json | |
done | |
- run: echo ] >> addons.json | |
# Publish | |
- uses: actions/setup-node@v3 | |
with: | |
registry-url: "https://registry.npmjs.org" | |
# - run: npm publish | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |