Skip to content

Build and Release HLTB for Deck #18

Build and Release HLTB for Deck

Build and Release HLTB for Deck #18

Workflow file for this run

name: Build and Release HLTB for Deck
# Creating releases manually via GUI.
on: workflow_dispatch
jobs:
increment-version:
runs-on: ubuntu-20.04
permissions:
contents: write
outputs:
BRANCH_NAME: ${{ steps.read_branch.outputs.branch_name }}
NEW_TAG_NAME: ${{ steps.increment-npm-version.outputs.v-version }}
RELEASE_ENTRY_TEXT: ${{ steps.git-cliff-release-entry.outputs.content }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read branch name
id: read_branch
shell: bash
run: echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- name: Increment npm version
uses: reecetech/[email protected]
id: increment-npm-version
with:
scheme: semver
increment: patch
- name: Write incremented version to package.json
uses: reedyuk/[email protected]
with:
version: ${{ steps.increment-npm-version.outputs.version }}
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff-release-entry
with:
config: cliff.toml
args: --verbose --strip all --tag ${{ steps.increment-npm-version.outputs.v-version }} --unreleased
env:
OUTPUT: CHANGES.md
- name: Get changelog since last release
uses: orhun/git-cliff-action@v4
id: git-cliff-file
with:
config: cliff.toml
args: --verbose --tag ${{ steps.increment-npm-version.outputs.v-version }}
env:
OUTPUT: CHANGELOG.md
- name: Commit CHANGELOG.md and package.json
if: github.ref_name == 'main'
id: change-log-commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: 'CHANGELOG.md package.json'
branch: ${{ steps.read_branch.outputs.branch_name }}
commit_message: "chore(release): preparing for upcoming release (CHANGELOG.md, package.json)"
build:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [increment-version]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ needs.increment-version.outputs.BRANCH_NAME }}
fetch-depth: 0
- name: Fetch the latest changes
run: git pull origin ${{ needs.increment-version.outputs.BRANCH_NAME }}
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18.12'
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Create package structure
run: |
cp plugin.json ./dist/
cp package.json ./dist/
mkdir ./dist/dist
rm ./dist/index.js.map
mv ./dist/index.js ./dist/dist/
mv ./dist ./hltb-for-deck
- name: Archive built files
run: |
zip -r hltb-for-deck.zip hltb-for-deck/*
tar -czvf hltb-for-deck.tar.gz hltb-for-deck
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: hltb-for-deck
path: |
hltb-for-deck.zip
hltb-for-deck.tar.gz
if-no-files-found: error
release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [increment-version, build]
steps:
- uses: actions/checkout@v4
- name: Downloading all built binaries
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}
name: hltb-for-deck
- name: List all built binaries
run: ls -R
- name: Create a release
uses: ncipollo/release-action@v1
with:
body: "${{ needs.increment-version.outputs.RELEASE_ENTRY_TEXT }}"
tag: "${{ needs.increment-version.outputs.NEW_TAG_NAME }}"
artifacts: "*.zip, *.tar.gz"