| 1 | name: Squad Insider Release |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [insider] |
| 6 | |
| 7 | permissions: |
| 8 | contents: write |
| 9 | |
| 10 | jobs: |
| 11 | release: |
| 12 | runs-on: ubuntu-latest |
| 13 | steps: |
| 14 | - uses: actions/checkout@v4 |
| 15 | with: |
| 16 | fetch-depth: 0 |
| 17 | |
| 18 | - uses: actions/setup-node@v4 |
| 19 | with: |
| 20 | node-version: 22 |
| 21 | |
| 22 | - name: Run tests |
| 23 | run: node --test test/*.test.cjs |
| 24 | |
| 25 | - name: Read version from package.json |
| 26 | id: version |
| 27 | run: | |
| 28 | VERSION=$(node -e "console.log(require('./package.json').version)") |
| 29 | SHORT_SHA=$(git rev-parse --short HEAD) |
| 30 | INSIDER_VERSION="${VERSION}-insider+${SHORT_SHA}" |
| 31 | INSIDER_TAG="v${INSIDER_VERSION}" |
| 32 | echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 33 | echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT" |
| 34 | echo "insider_version=$INSIDER_VERSION" >> "$GITHUB_OUTPUT" |
| 35 | echo "insider_tag=$INSIDER_TAG" >> "$GITHUB_OUTPUT" |
| 36 | echo "📦 Base Version: $VERSION (Short SHA: $SHORT_SHA)" |
| 37 | echo "🏷️ Insider Version: $INSIDER_VERSION" |
| 38 | echo "🔖 Insider Tag: $INSIDER_TAG" |
| 39 | |
| 40 | - name: Create git tag |
| 41 | run: | |
| 42 | git config user.name "github-actions[bot]" |
| 43 | git config user.email "github-actions[bot]@users.noreply.github.com" |
| 44 | git tag -a "${{ steps.version.outputs.insider_tag }}" -m "Insider Release ${{ steps.version.outputs.insider_tag }}" |
| 45 | git push origin "${{ steps.version.outputs.insider_tag }}" |
| 46 | |
| 47 | - name: Create GitHub Release |
| 48 | env: |
| 49 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | run: | |
| 51 | gh release create "${{ steps.version.outputs.insider_tag }}" \ |
| 52 | --title "${{ steps.version.outputs.insider_tag }}" \ |
| 53 | --notes "This is an insider/development build of Squad. Install with:\`\`\`bash\nnpm install -g @bradygaster/squad-cli@${{ steps.version.outputs.insider_tag }}\n\`\`\`\n\n**Note:** Insider builds may be unstable and are intended for early adopters and testing only." \ |
| 54 | --prerelease |
| 55 | |
| 56 | - name: Verify release |
| 57 | env: |
| 58 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | run: | |
| 60 | gh release view "${{ steps.version.outputs.insider_tag }}" |
| 61 | echo "✅ Insider Release ${{ steps.version.outputs.insider_tag }} created and verified." |