bitburner-src/.github/workflows/bump-version.yml

101 lines
3.5 KiB
YAML
Raw Normal View History

name: Bump BitBurner Version
on:
workflow_dispatch:
inputs:
version:
2022-04-07 01:30:08 +02:00
description: "Version (format: x.y.z)"
required: true
versionNumber:
2022-04-07 01:30:08 +02:00
description: "Version Number (for saves migration)"
required: true
changelog:
2022-04-07 01:30:08 +02:00
description: "Changelog (url that points to RAW markdown)"
default: ""
buildApp:
2022-04-07 01:30:08 +02:00
description: "Include Application Build"
type: boolean
2022-04-07 01:30:08 +02:00
default: "true"
required: true
buildDoc:
2022-04-07 01:30:08 +02:00
description: "Include Documentation Build"
type: boolean
2022-04-07 01:30:08 +02:00
default: "true"
required: true
prepareRelease:
2022-04-07 01:30:08 +02:00
description: "Prepare Draft Release"
type: boolean
2022-04-07 01:30:08 +02:00
default: "true"
required: true
jobs:
bumpVersion:
name: Bump Version
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Install pandoc dependency
run: sudo apt-get install -y pandoc
- name: Checkout repository
2024-08-15 22:08:21 +02:00
uses: actions/checkout@v4
with:
fetch-depth: 0
2024-08-15 22:08:21 +02:00
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
2024-08-15 22:08:21 +02:00
node-version: 20
2022-04-07 01:30:08 +02:00
cache: "npm"
- name: Install NPM dependencies for version updater
working-directory: ./tools/bump-version
run: npm ci
- name: Bump version & update changelogs
working-directory: ./tools/bump-version
run: |
curl ${{ github.event.inputs.changelog }} > changes.md
node index.js --version=${{ github.event.inputs.version }} --versionNumber=${{ github.event.inputs.versionNumber }} < changes.md
- name: Install NPM dependencies for app
if: ${{ github.event.inputs.buildApp == 'true' || github.event.inputs.buildDoc == 'true' }}
run: npm ci
- name: Build Production App
if: ${{ github.event.inputs.buildApp == 'true' }}
run: npm run build
- name: Build Documentation
if: ${{ github.event.inputs.buildDoc == 'true' }}
run: npm run doc
- name: Commit Files
run: |
git config --global user.name "GitHub"
git config --global user.email "noreply@github.com"
git checkout -b bump/v${{ github.event.inputs.version }}
git add -A
echo "Bump version to v${{ github.event.inputs.version }}" > commitmessage.txt
echo "" >> commitmessage.txt
cat ./tools/bump-version/changes.md >> commitmessage.txt
git commit -F commitmessage.txt
git push -u origin bump/v${{ github.event.inputs.version }}
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--base "${{ github.ref_name }}" \
--head "bump/v${{ github.event.inputs.version }}" \
--title "Bump version to v${{ github.event.inputs.version }}" \
--body-file ./tools/bump-version/changes.md
- name: Prepare release
if: ${{ github.event.inputs.prepareRelease == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_TITLE="$(head -n 1 ./tools/bump-version/changes.md | sed 's/## //')"
RELEASE_TITLE="${RELEASE_TITLE:-v${{ github.event.inputs.version }}}"
gh release create \
v${{ github.event.inputs.version }} \
--target dev \
--title "$RELEASE_TITLE" \
--notes-file ./tools/bump-version/changes.md \
--generate-notes \
--draft