chore(release): 0.1.2 #2
Workflow file for this run
This file contains hidden or 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: Release | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v4 | |
id: pnpm-install | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build project | |
run: pnpm build | |
- name: Get version from tag | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Create bot archive | |
run: | | |
# Create a directory for the release files | |
mkdir -p release | |
# Create the bot.tar.gz archive excluding src and node_modules | |
tar --exclude='./.git' --exclude='./.github' --exclude='./.husky' --exclude='./.vscode' --exclude='./docs' --exclude='./node_modules' --exclude='./release' --exclude='./scripts' --exclude='./src' -czf release/bot.tar.gz . | |
# Create checksum file | |
cd release | |
sha256sum bot.tar.gz > checksum.txt | |
cd .. | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: Release ${{ steps.get_version.outputs.VERSION }} | |
tag_name: ${{ steps.get_version.outputs.VERSION }} | |
draft: false | |
prerelease: false | |
files: | | |
release/bot.tar.gz | |
release/checksum.txt | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create or update 'latest' tag | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email 'actions@github.com' | |
git tag -f latest | |
git push -f origin latest |