Prepare release v0.3.3. (#41) #21
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: release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - goos: linux | |
| goarch: amd64 | |
| - goos: linux | |
| goarch: arm64 | |
| - goos: darwin | |
| goarch: amd64 | |
| - goos: darwin | |
| goarch: arm64 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - run: go tool builder --config collector/manifest.yaml --skip-compilation | |
| - run: cd dist && go build -trimpath -o otelcol-oxide . | |
| env: | |
| CGO_ENABLED: "0" | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| - run: | | |
| mv dist/otelcol-oxide dist/otelcol-oxide-${{ matrix.goos }}-${{ matrix.goarch }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: otelcol-oxide-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: dist/otelcol-oxide-${{ matrix.goos }}-${{ matrix.goarch }} | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - working-directory: dist | |
| run: sha256sum otelcol-oxide-* > checksums.txt | |
| - name: Create or update release | |
| run: | | |
| PREV=$(git tag -l 'v*' --sort=-version:refname | sed -n '2p') | |
| NOTES_ARGS="--generate-notes" | |
| if [ -n "$PREV" ]; then | |
| NOTES_ARGS="$NOTES_ARGS --notes-start-tag $PREV" | |
| fi | |
| if gh release view ${{ github.ref_name }} > /dev/null 2>&1; then | |
| gh release upload ${{ github.ref_name }} \ | |
| dist/otelcol-oxide-* dist/checksums.txt --clobber | |
| else | |
| gh release create ${{ github.ref_name }} \ | |
| $NOTES_ARGS \ | |
| dist/otelcol-oxide-* dist/checksums.txt | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| docker: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: otelcol-oxide-linux-* | |
| merge-multiple: true | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/metadata-action@v5 | |
| id: meta | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest | |
| # Note: Use Dockerfile.release and copy in images from the `build` step. | |
| # This is much faster than using `docker buildx` with the standard | |
| # Dockerfile, which relies on qemu for multi-arch builds and takes too long | |
| # to complete on GitHub Actions. | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: collector/Dockerfile.release | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |