fix: revert to old workflow (one that does cancelled) #88
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: Update Version | |
on: | |
push: | |
branches: [ main ] | |
schedule: | |
- cron: '0 0 * * *' | |
permissions: | |
actions: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v2 | |
- run: |- | |
version=$(bun run scripts/index.ts) | |
echo "version=$version" >> $GITHUB_ENV | |
name: Run scripts | |
- run: |- | |
git fetch --tags | |
if git tag --list | grep -q "^${version}$"; then | |
echo "err: version already exists" | |
gh run cancel ${{ github.run_id }} | |
gh run watch ${{ github.run_id }} | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
name: Release exists? | |
- run: |- | |
git fetch origin | |
git pull origin main | |
git add . | |
git diff | |
git config --global user.email "github-action-bot@example.com" | |
git config --global user.name "GitHub Action Bot" | |
git commit -m "chore: update version" -a || echo "err: no update available" | |
git push | |
name: Commit & Push | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "${{ env.version }}" | |
prerelease: false | |
title: "${{ env.version }}" | |
name: Create release |