|
| 1 | +name: Next Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [next] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + release: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + submodules: recursive |
| 19 | + |
| 20 | + - uses: actions/setup-go@v5 |
| 21 | + with: |
| 22 | + go-version: stable |
| 23 | + |
| 24 | + - name: Calculate version and create tag |
| 25 | + id: version |
| 26 | + run: | |
| 27 | + # Get latest stable semver tag (v0.0.0 format, exclude -next tags) |
| 28 | + LATEST_TAG=$(git tag --list 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1) |
| 29 | + if [ -z "$LATEST_TAG" ]; then |
| 30 | + LATEST_TAG="v0.0.0" |
| 31 | + fi |
| 32 | + SHORT_HASH=$(git rev-parse --short HEAD) |
| 33 | + VERSION="${LATEST_TAG}-next.${SHORT_HASH}" |
| 34 | + echo "Latest stable tag: $LATEST_TAG" |
| 35 | + echo "HEAD commit: $SHORT_HASH" |
| 36 | + echo "Creating tag: $VERSION" |
| 37 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 38 | + # Delete remote tag if it exists (in case of re-run) |
| 39 | + git push origin ":refs/tags/${VERSION}" 2>/dev/null || true |
| 40 | + git tag -f "$VERSION" |
| 41 | + git push origin "$VERSION" |
| 42 | +
|
| 43 | + - name: Run GoReleaser |
| 44 | + uses: goreleaser/goreleaser-action@v6 |
| 45 | + with: |
| 46 | + version: "~> v2" |
| 47 | + args: release --clean --config .goreleaser.next.yaml |
| 48 | + env: |
| 49 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.version }} |
| 51 | + |
| 52 | + - uses: ./.github/actions/setup-vscode-extension |
| 53 | + |
| 54 | + - name: Package VS Code extension |
| 55 | + run: pnpm package:extension |
| 56 | + |
| 57 | + - name: Upload VS Code extension to release |
| 58 | + run: | |
| 59 | + VSIX_FILE=$(ls integrations/vscode/*.vsix 2>/dev/null | head -1) |
| 60 | + if [ -z "$VSIX_FILE" ]; then |
| 61 | + echo "Error: No .vsix file found. Did the build step succeed?" |
| 62 | + exit 1 |
| 63 | + fi |
| 64 | + gh release upload "${{ steps.version.outputs.version }}" "$VSIX_FILE" --clobber |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments