|
7 | 7 |
|
8 | 8 | permissions: |
9 | 9 | contents: write |
| 10 | + packages: write |
10 | 11 |
|
11 | 12 | jobs: |
12 | 13 | build-and-upload: |
|
39 | 40 | BIN_NAME=inboundparse |
40 | 41 | if [ "${{ matrix.goos }}" = "windows" ]; then BIN_NAME="${BIN_NAME}.exe"; fi |
41 | 42 | mkdir -p dist |
42 | | - go build -trimpath -ldflags "-s -w" -o "dist/${BIN_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}" ./ |
| 43 | + go build -trimpath -ldflags "-s -w" -o "dist/${BIN_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}" ./cmd/inboundparse |
43 | 44 |
|
44 | 45 | - name: Upload artifact |
45 | 46 | uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
|
70 | 71 | files: assets/* |
71 | 72 | env: |
72 | 73 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + |
| 75 | + build-and-push-image: |
| 76 | + name: Build and push Docker image (GHCR) |
| 77 | + runs-on: ubuntu-latest |
| 78 | + steps: |
| 79 | + - name: Checkout |
| 80 | + uses: actions/checkout@v6.0.2 |
| 81 | + |
| 82 | + - name: Set up Docker Buildx |
| 83 | + uses: docker/setup-buildx-action@v4.0.0 |
| 84 | + |
| 85 | + - name: Log in to GitHub Container Registry |
| 86 | + uses: docker/login-action@v4.1.0 |
| 87 | + with: |
| 88 | + registry: ghcr.io |
| 89 | + username: ${{ github.actor }} |
| 90 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + |
| 92 | + - name: Docker image name (GHCR requires lowercase) |
| 93 | + id: image |
| 94 | + run: echo "name=ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" |
| 95 | + |
| 96 | + - name: Docker metadata (tags and labels) |
| 97 | + id: meta |
| 98 | + uses: docker/metadata-action@v6.0.0 |
| 99 | + with: |
| 100 | + images: ${{ steps.image.outputs.name }} |
| 101 | + tags: | |
| 102 | + type=semver,pattern={{version}} |
| 103 | + type=semver,pattern={{major}}.{{minor}} |
| 104 | + type=semver,pattern={{major}} |
| 105 | + type=raw,value=latest,enable=true |
| 106 | +
|
| 107 | + - name: Build and push |
| 108 | + uses: docker/build-push-action@v6.10 |
| 109 | + with: |
| 110 | + context: . |
| 111 | + push: true |
| 112 | + tags: ${{ steps.meta.outputs.tags }} |
| 113 | + labels: ${{ steps.meta.outputs.labels }} |
| 114 | + platforms: linux/amd64,linux/arm64 |
| 115 | + cache-from: type=gha |
| 116 | + cache-to: type=gha,mode=max |
0 commit comments