feat: publish v0.16
#11
Workflow file for this run
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: publish | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Retrieve Tag | |
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Publish Release | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { readFile } = require('fs/promises') | |
let changelog = await readFile('./changelog.md', { encoding: 'utf-8' }) | |
const startIndex = changelog.indexOf(`## [${process.env.TAG}]`) + `## [${process.env.TAG}](https://github.com/boywithkeyboard/updater/releases/tag/${process.env.TAG})\n\n`.length | |
changelog = changelog.substring(startIndex) | |
const endIndex = changelog.indexOf('\n\n## [') | |
changelog = changelog.substring(0, endIndex < 0 ? undefined : endIndex) | |
github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: process.env.TAG, | |
name: process.env.TAG, | |
body: changelog, | |
draft: false, | |
prerelease: false | |
}) | |
- name: Bump Major Version | |
run: | | |
full="$TAG" | |
short="${full:0:2}" | |
git tag $short -f | |
git push --tags -f |