|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + release: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + # Operating systems and architectures to compile |
| 17 | + include: |
| 18 | + - os: linux |
| 19 | + arch: amd64 |
| 20 | + goos: linux |
| 21 | + goarch: amd64 |
| 22 | + - os: linux |
| 23 | + arch: arm64 |
| 24 | + goos: linux |
| 25 | + goarch: arm64 |
| 26 | + - os: darwin |
| 27 | + arch: amd64 |
| 28 | + goos: darwin |
| 29 | + goarch: amd64 |
| 30 | + - os: darwin |
| 31 | + arch: arm64 |
| 32 | + goos: darwin |
| 33 | + goarch: arm64 |
| 34 | + - os: windows |
| 35 | + arch: amd64 |
| 36 | + goos: windows |
| 37 | + goarch: amd64 |
| 38 | + - os: windows |
| 39 | + arch: arm64 |
| 40 | + goos: windows |
| 41 | + goarch: arm64 |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout code |
| 45 | + uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Set up Go |
| 48 | + uses: actions/setup-go@v5 |
| 49 | + with: |
| 50 | + go-version: '1.23' |
| 51 | + |
| 52 | + - name: Get version from tag |
| 53 | + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
| 54 | + |
| 55 | + - name: Build binary |
| 56 | + env: |
| 57 | + GOOS: ${{ matrix.goos }} |
| 58 | + GOARCH: ${{ matrix.goarch }} |
| 59 | + CGO_ENABLED: 0 |
| 60 | + run: | |
| 61 | + # Create output directory |
| 62 | + mkdir -p dist |
| 63 | + |
| 64 | + # Define binary name |
| 65 | + if [ "${{ matrix.goos }}" = "windows" ]; then |
| 66 | + BINARY_NAME="coderun-${{ matrix.os }}-${{ matrix.arch }}.exe" |
| 67 | + else |
| 68 | + BINARY_NAME="coderun-${{ matrix.os }}-${{ matrix.arch }}" |
| 69 | + fi |
| 70 | + |
| 71 | + # Compile |
| 72 | + go build -ldflags="-s -w -X 'main.version=${{ env.VERSION }}'" -o "dist/${BINARY_NAME}" . |
| 73 | + |
| 74 | + # Verify file was created |
| 75 | + ls -la dist/ |
| 76 | +
|
| 77 | + - name: Upload artifacts |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: coderun-${{ matrix.os }}-${{ matrix.arch }} |
| 81 | + path: dist/ |
| 82 | + |
| 83 | + create-release: |
| 84 | + needs: release |
| 85 | + runs-on: ubuntu-latest |
| 86 | + steps: |
| 87 | + - name: Checkout code |
| 88 | + uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - name: Download all artifacts |
| 91 | + uses: actions/download-artifact@v4 |
| 92 | + with: |
| 93 | + path: dist/ |
| 94 | + |
| 95 | + - name: Get version from tag |
| 96 | + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
| 97 | + |
| 98 | + - name: Prepare release files |
| 99 | + run: | |
| 100 | + # Create final directory |
| 101 | + mkdir -p release |
| 102 | + |
| 103 | + # Move all binaries to release directory |
| 104 | + find dist/ -name "coderun-*" -type f -exec cp {} release/ \; |
| 105 | + |
| 106 | + # List files for verification |
| 107 | + ls -la release/ |
| 108 | +
|
| 109 | + - name: Generate checksums |
| 110 | + run: | |
| 111 | + cd release |
| 112 | + sha256sum * > checksums.txt |
| 113 | + cat checksums.txt |
| 114 | +
|
| 115 | + - name: Create Release |
| 116 | + uses: softprops/action-gh-release@v1 |
| 117 | + with: |
| 118 | + tag_name: ${{ env.VERSION }} |
| 119 | + name: Release ${{ env.VERSION }} |
| 120 | + body: | |
| 121 | + ## 🎉 CodeRun CLI ${{ env.VERSION }} |
| 122 | + |
| 123 | + ### 📦 Installation |
| 124 | + |
| 125 | + #### Linux (AMD64) |
| 126 | + ```bash |
| 127 | + curl -L https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/coderun-linux-amd64 -o coderun |
| 128 | + chmod +x coderun |
| 129 | + sudo mv coderun /usr/local/bin/ |
| 130 | + ``` |
| 131 | + |
| 132 | + #### Linux (ARM64) |
| 133 | + ```bash |
| 134 | + curl -L https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/coderun-linux-arm64 -o coderun |
| 135 | + chmod +x coderun |
| 136 | + sudo mv coderun /usr/local/bin/ |
| 137 | + ``` |
| 138 | + |
| 139 | + #### macOS (Intel) |
| 140 | + ```bash |
| 141 | + curl -L https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/coderun-darwin-amd64 -o coderun |
| 142 | + chmod +x coderun |
| 143 | + sudo mv coderun /usr/local/bin/ |
| 144 | + ``` |
| 145 | + |
| 146 | + #### macOS (Apple Silicon) |
| 147 | + ```bash |
| 148 | + curl -L https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/coderun-darwin-arm64 -o coderun |
| 149 | + chmod +x coderun |
| 150 | + sudo mv coderun /usr/local/bin/ |
| 151 | + ``` |
| 152 | + |
| 153 | + #### Windows (AMD64) |
| 154 | + Download `coderun-windows-amd64.exe` and rename it to `coderun.exe` |
| 155 | + |
| 156 | + #### Windows (ARM64) |
| 157 | + Download `coderun-windows-arm64.exe` and rename it to `coderun.exe` |
| 158 | + |
| 159 | + ### ✅ Installation Verification |
| 160 | + ```bash |
| 161 | + coderun --version |
| 162 | + ``` |
| 163 | + |
| 164 | + ### 🔒 Integrity Verification |
| 165 | + You can verify file integrity using `checksums.txt` |
| 166 | + |
| 167 | + files: | |
| 168 | + release/* |
| 169 | + draft: false |
| 170 | + prerelease: false |
| 171 | + env: |
| 172 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments