BuildnPush #15
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: BuildnPush | |
| permissions: | |
| contents: read | |
| packages: write | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| unit-tests: | |
| name: Run unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.21' | |
| - name: Run tests | |
| run: | | |
| go test ./... | |
| image-build-n-push: | |
| name: Build and push multi-arch container image | |
| runs-on: ubuntu-latest | |
| needs: [unit-tests] | |
| env: | |
| IMAGE_REGISTRY: ghcr.io/canonicalflow | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up QEMU (multi-arch) | |
| uses: docker/setup-qemu-action@v2 | |
| with: | |
| platforms: all | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to GitHub Container Registry | |
| run: | | |
| echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io \ | |
| -u ${GITHUB_ACTOR,,} --password-stdin | |
| - name: Build and push multi-arch image | |
| run: | | |
| IMAGE_REGISTRY="${{ env.IMAGE_REGISTRY }}" make docker-build-push |