Skip to content

Republish ove umd files #556

Republish ove umd files

Republish ove umd files #556

name: Republish ove umd files
on:
schedule:
- cron: '23 4 * * *'
workflow_dispatch:
jobs:
get_versions:
runs-on: ubuntu-22.04
outputs:
ove_version: ${{ steps.setver.outputs.ove_version }}
update: ${{ steps.setver.outputs.update }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: install
run: npm install
- name: set, compare, and store versions
id: setver
run: |
ove_version=$(npm view @teselagen/ove version)
ove_umd_version="$(node -pe "require('./tg-oss-ove-umd/package.json').version")"
echo "ove_version: $ove_version"
echo "ove_umd_version: $ove_umd_version"
echo "ove_version=$ove_version" >> $GITHUB_OUTPUT
echo "update=$(npx semver --range "<$ove_version" "$ove_umd_version")" >> $GITHUB_OUTPUT
publish:
needs: get_versions
runs-on: ubuntu-22.04
if: needs.get_versions.outputs.update != 0
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Install latest OVE
run: npm install @teselagen/ove@${{ needs.get_versions.outputs.ove_version }} --silent
- name: Copy umd files
run: bash -c 'cp node_modules/@teselagen/ove/{index.umd.js,style.css} tg-oss-ove-umd/'
- name: Update package version
run: npm version --allow-same-version ${{ needs.get_versions.outputs.ove_version }}
working-directory: ./tg-oss-ove-umd
- name: "Publish @deltablot/tg-oss-ove-umd"
run: npm publish --access public
working-directory: ./tg-oss-ove-umd
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Cleanup
run: |
shopt -s extglob
rm -rf !('package.json'|'README.md')
working-directory: ./tg-oss-ove-umd
- name: Commit new version
run: |
git config --global user.name 'Marcel Bolten'
git config --global user.email '[email protected]'
git commit -am "Automated update, version ${{ needs.get_versions.outputs.ove_version }}"
git push