feat(update): add version check and fix text file busy on Linux #13
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: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - run: go test ./... | |
| release: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Determine version | |
| id: version | |
| run: | | |
| VERSION="v0.0.1-build.$(git rev-list --count HEAD).$(git rev-parse --short HEAD)" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Build all platforms | |
| run: make dist VERSION=${{ steps.version.outputs.version }} | |
| - name: Delete old release assets | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release delete latest --yes --cleanup-tag 2>/dev/null || true | |
| - name: Create latest release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: latest | |
| name: "Latest (${{ steps.version.outputs.version }})" | |
| files: dist/*.tar.gz | |
| prerelease: true | |
| make_latest: true | |
| generate_release_notes: false | |
| body: | | |
| Rolling release from `main` branch. | |
| **Version:** `${{ steps.version.outputs.version }}` | |
| **Commit:** ${{ github.sha }} | |
| deploy: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Deploy to Cloudflare Pages | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy website/public --project-name anycli |