Skip to content

Nightly Release

Nightly Release #193

name: Nightly Release
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
env:
HUSKY: 0
jobs:
nightly-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for changelog generation
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "yarn"
- name: Install dependencies
env:
YARN_ENABLE_HARDENED_MODE: false
run: yarn install --immutable
- name: Build Extension
run: yarn build
- name: Package Extension
run: yarn package
- name: Generate Changelog
id: changelog
run: |
# Get the latest 0.x.0 release tag
LAST_MAJOR=$(git tag -l "v0.*" | grep -E "v0\.[0-9]+\.0$" | sort -V | tail -n1)
if [ -z "$LAST_MAJOR" ]; then
# If no major release found, use all commits
LAST_MAJOR=$(git rev-list --max-parents=0 HEAD)
fi
# Generate changelog from commits
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "## What's Changed (since $LAST_MAJOR)" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
git log "$LAST_MAJOR..HEAD" --pretty=format:"* %s (%h)" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Language Server Archive
run: |
VERSION=$(node -p "require('./package.json').version")
mkdir -p tact-language-server
cp -r dist/* tact-language-server/
cp package.json tact-language-server/
tar -czf tact-language-server-v${VERSION}.tar.gz tact-language-server/
zip -r tact-language-server-v${VERSION}.zip tact-language-server/
- name: Update Nightly Release
run: |
VERSION=$(node -p "require('./package.json').version")
# Check if release exists before trying to delete it
if gh release view nightly &>/dev/null; then
echo "Deleting existing nightly release..."
gh release delete nightly --yes
fi
# Check if tag exists before trying to delete it
if git fetch origin nightly &>/dev/null; then
echo "Deleting existing nightly tag..."
git push origin :refs/tags/nightly || true
fi
# Delete local tag if it exists
git tag -d nightly 2>/dev/null || true
# Create release notes
RELEASE_NOTES="🌙 This is an automated nightly build from the master branch.
${CHANGELOG}
## Installation
### VS Code Extension
- Download the .vsix file and install it through VS Code
### Other Editors
- Download tact-language-server-v${VERSION}.tar.gz (Linux/macOS) or tact-language-server-v${VERSION}.zip (Windows)
- Extract it to a convenient location
- Configure your editor to use the language server from the extracted folder"
echo "Creating new nightly release..."
echo "$RELEASE_NOTES" > release_notes.md
# Create new release with tag
gh release create nightly \
--title "Nightly Build v${VERSION}" \
--notes-file release_notes.md \
--prerelease \
--target master \
*.vsix "tact-language-server-v${VERSION}.tar.gz" "tact-language-server-v${VERSION}.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}