chore: final cleanup — fix workflows, remaining hivemind refs, lock f… #1
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: Worker build and release | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['worker-v*.*.*'] | |
| paths: ['worker/**'] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| ports: ["6379:6379"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: 1.78.0 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: worker | |
| - name: Test | |
| run: cd worker && cargo test | |
| - name: Clippy | |
| run: cd worker && cargo clippy -- -D warnings | |
| - name: Format | |
| run: cd worker && cargo fmt --check | |
| build-and-push: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get version from tag | |
| id: ver | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/worker-v* ]]; then | |
| echo "version=${GITHUB_REF#refs/tags/worker-v}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=latest" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository_owner }}/devsper-worker | |
| tags: | | |
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
| type=raw,value=${{ steps.ver.outputs.version }},enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
| type=sha,prefix=sha- | |
| - name: Build and push | |
| id: push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: worker | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Generate SBOM | |
| uses: anchore/sbom-action@v0.15.0 | |
| with: | |
| image: ghcr.io/${{ github.repository_owner }}/devsper-worker@${{ steps.push.outputs.digest }} | |
| format: spdx-json | |
| output-file: sbom.spdx.json | |
| - name: Sign image | |
| uses: sigstore/cosign-installer@v3 | |
| - run: cosign sign --yes ghcr.io/${{ github.repository_owner }}/devsper-worker@${{ steps.push.outputs.digest }} | |
| update-docs: | |
| needs: build-and-push | |
| if: startsWith(github.ref, 'refs/tags/worker-v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version | |
| id: ver | |
| run: echo "version=${GITHUB_REF#refs/tags/worker-v}" >> $GITHUB_OUTPUT | |
| - name: Update worker README pull example | |
| run: | | |
| sed -i "s/:latest/:${{ steps.ver.outputs.version }}/" worker/README.md | |
| sed -i "s/:latest/:${{ steps.ver.outputs.version }}/" worker/README.md || true | |
| - name: Commit and push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add worker/README.md | |
| git diff --staged --quiet || git commit -m "chore: update worker image tag to ${{ steps.ver.outputs.version }}" | |
| git push || true |