|
| 1 | +name: release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + packages: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + include: |
| 17 | + - goos: linux |
| 18 | + goarch: amd64 |
| 19 | + - goos: linux |
| 20 | + goarch: arm64 |
| 21 | + - goos: darwin |
| 22 | + goarch: amd64 |
| 23 | + - goos: darwin |
| 24 | + goarch: arm64 |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + - uses: actions/setup-go@v5 |
| 29 | + with: |
| 30 | + go-version-file: go.mod |
| 31 | + |
| 32 | + - run: make install-builder |
| 33 | + |
| 34 | + - run: builder --config collector/manifest.yaml |
| 35 | + env: |
| 36 | + GOOS: ${{ matrix.goos }} |
| 37 | + GOARCH: ${{ matrix.goarch }} |
| 38 | + |
| 39 | + - run: | |
| 40 | + mv dist/otelcol-oxide dist/otelcol-oxide-${{ matrix.goos }}-${{ matrix.goarch }} |
| 41 | +
|
| 42 | + - uses: actions/upload-artifact@v4 |
| 43 | + with: |
| 44 | + name: otelcol-oxide-${{ matrix.goos }}-${{ matrix.goarch }} |
| 45 | + path: dist/otelcol-oxide-${{ matrix.goos }}-${{ matrix.goarch }} |
| 46 | + |
| 47 | + release: |
| 48 | + needs: build |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/download-artifact@v4 |
| 52 | + with: |
| 53 | + path: dist |
| 54 | + merge-multiple: true |
| 55 | + |
| 56 | + - working-directory: dist |
| 57 | + run: sha256sum otelcol-oxide-* > checksums.txt |
| 58 | + |
| 59 | + - uses: softprops/action-gh-release@v2 |
| 60 | + with: |
| 61 | + files: | |
| 62 | + dist/otelcol-oxide-* |
| 63 | + dist/checksums.txt |
| 64 | + generate_release_notes: true |
| 65 | + |
| 66 | + docker: |
| 67 | + needs: build |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v4 |
| 71 | + |
| 72 | + - uses: actions/download-artifact@v4 |
| 73 | + with: |
| 74 | + pattern: otelcol-oxide-linux-* |
| 75 | + merge-multiple: true |
| 76 | + |
| 77 | + - uses: docker/setup-buildx-action@v3 |
| 78 | + |
| 79 | + - uses: docker/login-action@v3 |
| 80 | + with: |
| 81 | + registry: ghcr.io |
| 82 | + username: ${{ github.actor }} |
| 83 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + |
| 85 | + - uses: docker/metadata-action@v5 |
| 86 | + id: meta |
| 87 | + with: |
| 88 | + images: ghcr.io/${{ github.repository }} |
| 89 | + tags: | |
| 90 | + type=semver,pattern={{version}} |
| 91 | + type=semver,pattern={{major}}.{{minor}} |
| 92 | + type=semver,pattern={{major}} |
| 93 | + type=raw,value=latest |
| 94 | +
|
| 95 | + # Note: Use Dockerfile.release and copy in images from the `build` step. |
| 96 | + # This is much faster than using `docker buildx` with the standard |
| 97 | + # Dockerfile, which relies on qemu for multi-arch builds and takes too long |
| 98 | + # to complete on GitHub Actions. |
| 99 | + - uses: docker/build-push-action@v6 |
| 100 | + with: |
| 101 | + context: . |
| 102 | + file: collector/Dockerfile.release |
| 103 | + platforms: linux/amd64,linux/arm64 |
| 104 | + push: true |
| 105 | + tags: ${{ steps.meta.outputs.tags }} |
| 106 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments