feat: corpus-back golang practice loader + 3 P0 concurrency/error practices #177
Workflow file for this run
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: Verify and Publish Docker image | |
| on: | |
| push: | |
| branches: ['main'] | |
| pull_request: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| verify: | |
| name: Verify (${{ matrix.os }}, Bun ${{ matrix.bun-version }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| bun-version: [latest] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: ${{ matrix.bun-version }} | |
| - name: Cache Bun dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb', '**/package.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Compile runtime context | |
| run: bun run compile:context | |
| - name: Regenerate skills index | |
| run: bun run skills:index | |
| - name: Run tests | |
| run: bun test | |
| - name: Type-check | |
| run: bun run build | |
| release-and-publish: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: verify | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if version tag exists | |
| id: check | |
| run: | | |
| VERSION=$(jq -r .version package.json) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| if git ls-remote --tags origin | grep -q "refs/tags/v${VERSION}$"; then | |
| echo "new=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "new=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create GitHub release | |
| if: steps.check.outputs.new == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "v${{ steps.check.outputs.version }}" \ | |
| --title "v${{ steps.check.outputs.version }}" \ | |
| --generate-notes | |
| - name: Log in to GitHub Container Registry | |
| if: steps.check.outputs.new == 'true' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| if: steps.check.outputs.new == 'true' | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Set up Docker Buildx | |
| if: steps.check.outputs.new == 'true' | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| if: steps.check.outputs.new == 'true' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |