|
| 1 | +name: taco-release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'taco/cli/v*' |
| 7 | + - 'taco/statesman/v*' |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + packages: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - os: linux |
| 20 | + arch: amd64 |
| 21 | + goos: linux |
| 22 | + goarch: amd64 |
| 23 | + - os: linux |
| 24 | + arch: arm64 |
| 25 | + goos: linux |
| 26 | + goarch: arm64 |
| 27 | + - os: linux |
| 28 | + arch: 386 |
| 29 | + goos: linux |
| 30 | + goarch: 386 |
| 31 | + - os: darwin |
| 32 | + arch: amd64 |
| 33 | + goos: darwin |
| 34 | + goarch: amd64 |
| 35 | + - os: darwin |
| 36 | + arch: arm64 |
| 37 | + goos: darwin |
| 38 | + goarch: arm64 |
| 39 | + - os: windows |
| 40 | + arch: amd64 |
| 41 | + goos: windows |
| 42 | + goarch: amd64 |
| 43 | + - os: windows |
| 44 | + arch: 386 |
| 45 | + goos: windows |
| 46 | + goarch: 386 |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + fetch-depth: 0 |
| 51 | + |
| 52 | + - uses: actions/setup-go@v5 |
| 53 | + with: |
| 54 | + go-version: '1.24' |
| 55 | + |
| 56 | + - name: Derive app dir and version |
| 57 | + id: meta |
| 58 | + run: | |
| 59 | + TAG="${GITHUB_REF_NAME}" # e.g. taco/cli/v1.2.3 |
| 60 | + APP_DIR="${TAG%/v*}" # taco/cli |
| 61 | + VERSION="${TAG##*/}" # v1.2.3 |
| 62 | + echo "app_dir=$APP_DIR" >> $GITHUB_OUTPUT |
| 63 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 64 | + # Map to actual directory paths |
| 65 | + if [ "$APP_DIR" = "taco/cli" ]; then |
| 66 | + echo "build_dir=taco/cmd/taco" >> $GITHUB_OUTPUT |
| 67 | + elif [ "$APP_DIR" = "taco/statesman" ]; then |
| 68 | + echo "build_dir=taco/cmd/statesman" >> $GITHUB_OUTPUT |
| 69 | + fi |
| 70 | +
|
| 71 | + - name: Build CLI |
| 72 | + if: startsWith(steps.meta.outputs.app_dir, 'taco/cli') |
| 73 | + working-directory: taco/cmd/taco |
| 74 | + run: | |
| 75 | + CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build \ |
| 76 | + -ldflags="-X 'main.Version=${{ steps.meta.outputs.version }}' -X 'main.Commit=${{ github.sha }}' -s -w" \ |
| 77 | + -o taco-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.goos == 'windows' && '.exe' || '' }} . |
| 78 | + sha256sum taco-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.goos == 'windows' && '.exe' || '' }} > taco-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.goos == 'windows' && '.exe' || '' }}.sha256 |
| 79 | +
|
| 80 | + - name: Build Statesman |
| 81 | + if: startsWith(steps.meta.outputs.app_dir, 'taco/statesman') |
| 82 | + working-directory: taco/cmd/statesman |
| 83 | + run: | |
| 84 | + CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build \ |
| 85 | + -ldflags="-X 'main.Version=${{ steps.meta.outputs.version }}' -X 'main.Commit=${{ github.sha }}' -s -w" \ |
| 86 | + -o statesman-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.goos == 'windows' && '.exe' || '' }} . |
| 87 | + sha256sum statesman-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.goos == 'windows' && '.exe' || '' }} > statesman-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.goos == 'windows' && '.exe' || '' }}.sha256 |
| 88 | +
|
| 89 | + - name: Upload CLI artifacts |
| 90 | + if: startsWith(steps.meta.outputs.app_dir, 'taco/cli') |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: taco-cli-${{ matrix.os }}-${{ matrix.arch }} |
| 94 | + path: taco/cmd/taco/taco-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.goos == 'windows' && '.exe' || '' }}* |
| 95 | + |
| 96 | + - name: Upload Statesman artifacts |
| 97 | + if: startsWith(steps.meta.outputs.app_dir, 'taco/statesman') |
| 98 | + uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + name: taco-statesman-${{ matrix.os }}-${{ matrix.arch }} |
| 101 | + path: taco/cmd/statesman/statesman-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.goos == 'windows' && '.exe' || '' }}* |
| 102 | + |
| 103 | + build-docker: |
| 104 | + if: startsWith(github.ref_name, 'taco/statesman/') |
| 105 | + runs-on: ubuntu-latest |
| 106 | + steps: |
| 107 | + - uses: actions/checkout@v4 |
| 108 | + with: |
| 109 | + fetch-depth: 0 |
| 110 | + |
| 111 | + - uses: actions/setup-go@v5 |
| 112 | + with: |
| 113 | + go-version: '1.24' |
| 114 | + |
| 115 | + - name: Derive version |
| 116 | + id: meta |
| 117 | + run: | |
| 118 | + TAG="${GITHUB_REF_NAME}" # e.g. taco/statesman/v1.2.3 |
| 119 | + VERSION="${TAG##*/}" # v1.2.3 |
| 120 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 121 | +
|
| 122 | + - name: Set up Docker Buildx |
| 123 | + uses: docker/setup-buildx-action@v3 |
| 124 | + |
| 125 | + - name: Log in to Container Registry |
| 126 | + uses: docker/login-action@v3 |
| 127 | + with: |
| 128 | + registry: ghcr.io |
| 129 | + username: ${{ github.actor }} |
| 130 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 131 | + |
| 132 | + - name: Extract metadata |
| 133 | + id: docker-meta |
| 134 | + uses: docker/metadata-action@v5 |
| 135 | + with: |
| 136 | + images: ghcr.io/${{ github.repository }}/taco-statesman |
| 137 | + tags: | |
| 138 | + type=ref,event=tag |
| 139 | + type=semver,pattern={{version}} |
| 140 | + type=semver,pattern={{major}}.{{minor}} |
| 141 | + type=raw,value=latest |
| 142 | +
|
| 143 | + - name: Build and push Docker image |
| 144 | + uses: docker/build-push-action@v5 |
| 145 | + with: |
| 146 | + context: ./taco |
| 147 | + file: ./taco/Dockerfile_statesman |
| 148 | + push: true |
| 149 | + tags: ${{ steps.docker-meta.outputs.tags }} |
| 150 | + labels: ${{ steps.docker-meta.outputs.labels }} |
| 151 | + build-args: | |
| 152 | + COMMIT_SHA=${{ github.sha }} |
| 153 | + VERSION=${{ steps.meta.outputs.version }} |
| 154 | +
|
| 155 | + create-release-cli: |
| 156 | + if: startsWith(github.ref_name, 'taco/cli/') |
| 157 | + needs: [build] |
| 158 | + runs-on: ubuntu-latest |
| 159 | + steps: |
| 160 | + - uses: actions/checkout@v4 |
| 161 | + with: |
| 162 | + fetch-depth: 0 |
| 163 | + |
| 164 | + - name: Derive app dir and version |
| 165 | + id: meta |
| 166 | + run: | |
| 167 | + TAG="${GITHUB_REF_NAME}" # e.g. taco/cli/v1.2.3 |
| 168 | + APP_DIR="${TAG%/v*}" # taco/cli |
| 169 | + VERSION="${TAG##*/}" # v1.2.3 |
| 170 | + echo "app_dir=$APP_DIR" >> $GITHUB_OUTPUT |
| 171 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 172 | +
|
| 173 | + - name: Download all artifacts |
| 174 | + uses: actions/download-artifact@v4 |
| 175 | + |
| 176 | + - name: Create release for CLI |
| 177 | + uses: softprops/action-gh-release@v1 |
| 178 | + with: |
| 179 | + tag_name: ${{ github.ref_name }} |
| 180 | + name: taco/cli/${{ steps.meta.outputs.version }} |
| 181 | + body: | |
| 182 | + ## Taco CLI ${{ steps.meta.outputs.version }} |
| 183 | + |
| 184 | + ### Downloads |
| 185 | + - **Linux AMD64**: [taco-linux-amd64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-linux-amd64) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-linux-amd64.sha256)) |
| 186 | + - **Linux ARM64**: [taco-linux-arm64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-linux-arm64) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-linux-arm64.sha256)) |
| 187 | + - **Linux 386**: [taco-linux-386](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-linux-386) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-linux-386.sha256)) |
| 188 | + - **macOS AMD64**: [taco-darwin-amd64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-darwin-amd64) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-darwin-amd64.sha256)) |
| 189 | + - **macOS ARM64**: [taco-darwin-arm64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-darwin-arm64) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-darwin-arm64.sha256)) |
| 190 | + - **Windows AMD64**: [taco-windows-amd64.exe](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-windows-amd64.exe) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-windows-amd64.exe.sha256)) |
| 191 | + - **Windows 386**: [taco-windows-386.exe](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-windows-386.exe) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/taco-windows-386.exe.sha256)) |
| 192 | + |
| 193 | + ### Installation |
| 194 | + Download the appropriate binary for your platform and make it executable: |
| 195 | + ```bash |
| 196 | + chmod +x taco-<platform>-<arch> |
| 197 | + sudo mv taco-<platform>-<arch> /usr/local/bin/taco |
| 198 | + ``` |
| 199 | + files: | |
| 200 | + taco-cli-*/* |
| 201 | + draft: false |
| 202 | + prerelease: false |
| 203 | + |
| 204 | + create-release-statesman: |
| 205 | + if: startsWith(github.ref_name, 'taco/statesman/') |
| 206 | + needs: [build, build-docker] |
| 207 | + runs-on: ubuntu-latest |
| 208 | + steps: |
| 209 | + - uses: actions/checkout@v4 |
| 210 | + with: |
| 211 | + fetch-depth: 0 |
| 212 | + |
| 213 | + - name: Derive app dir and version |
| 214 | + id: meta |
| 215 | + run: | |
| 216 | + TAG="${GITHUB_REF_NAME}" # e.g. taco/statesman/v1.2.3 |
| 217 | + APP_DIR="${TAG%/v*}" # taco/statesman |
| 218 | + VERSION="${TAG##*/}" # v1.2.3 |
| 219 | + echo "app_dir=$APP_DIR" >> $GITHUB_OUTPUT |
| 220 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 221 | +
|
| 222 | + - name: Download all artifacts |
| 223 | + uses: actions/download-artifact@v4 |
| 224 | + |
| 225 | + - name: Create release for Statesman |
| 226 | + uses: softprops/action-gh-release@v1 |
| 227 | + with: |
| 228 | + tag_name: ${{ github.ref_name }} |
| 229 | + name: taco/statesman/${{ steps.meta.outputs.version }} |
| 230 | + body: | |
| 231 | + ## Taco Statesman ${{ steps.meta.outputs.version }} |
| 232 | + |
| 233 | + ### Downloads |
| 234 | + - **Linux AMD64**: [statesman-linux-amd64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-linux-amd64) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-linux-amd64.sha256)) |
| 235 | + - **Linux ARM64**: [statesman-linux-arm64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-linux-arm64) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-linux-arm64.sha256)) |
| 236 | + - **Linux 386**: [statesman-linux-386](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-linux-386) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-linux-386.sha256)) |
| 237 | + - **macOS AMD64**: [statesman-darwin-amd64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-darwin-amd64) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-darwin-amd64.sha256)) |
| 238 | + - **macOS ARM64**: [statesman-darwin-arm64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-darwin-arm64) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-darwin-arm64.sha256)) |
| 239 | + - **Windows AMD64**: [statesman-windows-amd64.exe](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-windows-amd64.exe) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-windows-amd64.exe.sha256)) |
| 240 | + - **Windows 386**: [statesman-windows-386.exe](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-windows-386.exe) ([checksum](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/statesman-windows-386.exe.sha256)) |
| 241 | + |
| 242 | + ### Docker |
| 243 | + ```bash |
| 244 | + docker pull ghcr.io/${{ github.repository }}/taco-statesman:${{ steps.meta.outputs.version }} |
| 245 | + ``` |
| 246 | + |
| 247 | + ### Installation |
| 248 | + Download the appropriate binary for your platform and make it executable: |
| 249 | + ```bash |
| 250 | + chmod +x statesman-<platform>-<arch> |
| 251 | + sudo mv statesman-<platform>-<arch> /usr/local/bin/statesman |
| 252 | + ``` |
| 253 | + files: | |
| 254 | + taco-statesman-*/* |
| 255 | + draft: false |
| 256 | + prerelease: false |
0 commit comments