Skip to content

update

update #8

Workflow file for this run

name: 'update'
on:
schedule:
- cron: '0 0 * * 5'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: 'Install dependencies'
run: npm i
- name: 'Calculate version'
id: calculate_version
uses: actions/github-script@v7
with:
script: |
const year = new Date().getFullYear()
let month = new Date().getMonth() + 1
let day = new Date().getDate()
if (month < 10)
month = '0' + month.toString()
if (day < 10)
day = '0' + day.toString()
return `1.${year + month + day}.0`
- name: 'Build package'
env:
VERSION: ${{ steps.calculate_version.outputs.result }}
run: npm run build && npm version $VERSION
- name: 'Publish package'
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
- name: 'Commit changes'
env:
VERSION: ${{ steps.calculate_version.outputs.result }}
run: |
git config --global user.name 'GitHub'
git config --global user.email '[email protected]'
git commit -am "package: `$VERSION`"
git push
- name: 'Create release'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.calculate_version.outputs.result }}
run: gh release create $VERSION --title $VERSION