Skip to content

update

update #54

Workflow file for this run

name: update
on:
schedule:
- cron: 0 0 * * 5
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Dependencies
run: npm i
- name: Determine Version
uses: actions/github-script@v7
with:
script: |
const { readFileSync, writeFileSync } = require('node:fs')
const year = new Date().getFullYear().toString()
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()
const version = `1.${year + month + day}.0`
core.exportVariable('VERSION', version)
const packageJson = JSON.parse(readFileSync('./package.json', { encoding: 'utf-8' }))
packageJson.version = version
writeFileSync('./package.json', JSON.stringify(packageJson, null, 2))
- name: Build Package
run: npm run build
- name: Publish Package
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
provenance: true
- name: Commit Changes
run: |
git config --global user.name "GitHub"
git config --global user.email "noreply@github.com"
git commit -am "refactor: autoupdate"
git push
- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create $VERSION --title $VERSION