release v1.12.0-rc.2 #555
This file contains 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: | |
branches: | |
- "v[0-9]+.[0-9]+" | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" | |
# Permission forced by repo-level setting; only elevate on job-level | |
permissions: | |
contents: read | |
# packages: read | |
env: | |
GO_VERSION: 1.22.7 | |
jobs: | |
build-linux-binary: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
permissions: | |
# https://github.com/marketplace/actions/goreleaser-action | |
contents: write | |
# actions/upload-artifact@v3 | |
actions: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: gcc install | |
run: sudo apt-get update; sudo apt install gcc-aarch64-linux-gnu | |
- name: Get tag | |
uses: little-core-labs/get-git-tag@v3.0.2 | |
id: tag | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Get Latest Release | |
id: latest_version | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
owner: ${{ github.repository_owner }} | |
repo: datadog-operator | |
excludes: prerelease, draft | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
version: 2.4.1 | |
args: release --skip=publish --config .goreleaser-for-linux.yaml | |
env: | |
GORELEASER_PREVIOUS_TAG: ${{steps.latest_version.outputs.release}} | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: kubectl-datadog-linux | |
path: | | |
dist/kubectl-datadog_*.zip | |
dist/checksums.txt | |
dist/CHANGELOG.md | |
build-darwin-binary: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: macos-latest | |
permissions: | |
# https://github.com/marketplace/actions/goreleaser-action | |
contents: write | |
# actions/upload-artifact@v3 | |
actions: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get tag | |
uses: little-core-labs/get-git-tag@v3.0.2 | |
id: tag | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Get Latest Release | |
id: latest_version | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
owner: ${{ github.repository_owner }} | |
repo: datadog-operator | |
excludes: prerelease, draft | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
args: release --skip=publish --config .goreleaser-for-darwin.yaml | |
env: | |
GORELEASER_PREVIOUS_TAG: ${{steps.latest_version.outputs.release}} | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: kubectl-datadog-darwin | |
path: | | |
dist/kubectl-datadog_*.zip | |
dist/checksums.txt | |
build-windows-binary: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
permissions: | |
# https://github.com/marketplace/actions/goreleaser-action | |
contents: write | |
# actions/upload-artifact@v3 | |
actions: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get tag | |
uses: little-core-labs/get-git-tag@v3.0.2 | |
id: tag | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Get Latest Release | |
id: latest_version | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
owner: ${{ github.repository_owner }} | |
repo: datadog-operator | |
excludes: prerelease, draft | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
args: release --skip=publish --config .goreleaser-for-windows.yaml | |
env: | |
GORELEASER_PREVIOUS_TAG: ${{steps.latest_version.outputs.release}} | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: kubectl-datadog-windows | |
path: | | |
dist/kubectl-datadog_*.zip | |
dist/checksums.txt | |
create-release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [build-linux-binary, build-darwin-binary, build-windows-binary] | |
runs-on: ubuntu-latest | |
permissions: | |
# https://github.com/marketplace/actions/goreleaser-action | |
# https://github.com/softprops/action-gh-release?tab=readme-ov-file#permissions | |
contents: write | |
# actions/download-artifact@v3 | |
actions: read | |
# rajatjindal/krew-release-bot@v0.0.43 | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Make directories | |
run: | | |
mkdir -p ./dist/linux | |
mkdir -p ./dist/darwin | |
mkdir -p ./dist/windows | |
- name: Download linux binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: kubectl-datadog-linux | |
path: ./tmp-build/linux | |
- name: Download darwin binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: kubectl-datadog-darwin | |
path: ./tmp-build/darwin | |
- name: Download windows binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: kubectl-datadog-windows | |
path: ./tmp-build/windows | |
- name: Get tag | |
uses: little-core-labs/get-git-tag@v3.0.2 | |
id: tag | |
- name: Prepare ./dist folder | |
run: | | |
mkdir -p ./dist | |
cat ./tmp-build/darwin/checksums.txt >> ./dist/checksums.txt | |
cat ./tmp-build/linux/checksums.txt >> ./dist/checksums.txt | |
cat ./tmp-build/windows/checksums.txt >> ./dist/checksums.txt | |
cp ./tmp-build/linux/CHANGELOG.md dist/CHANGELOG.md | |
mv ./tmp-build/darwin/*.zip ./dist | |
mv ./tmp-build/linux/*.zip ./dist | |
mv ./tmp-build/windows/*.zip ./dist | |
- name: Generate Plugin manifest | |
run: ./hack/release/generate-plugin-manifest.sh ${{steps.tag.outputs.tag}} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: dist/CHANGELOG.md | |
prerelease: ${{ contains(github.ref, '-rc.') }} | |
files: | | |
dist/datadog-plugin.yaml | |
dist/*.zip | |
dist/*.tar.gz | |
dist/checksums.txt | |
env: | |
COMMIT_TAG: ${{steps.tag.outputs.tag}} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update new plugin version in krew-index | |
uses: rajatjindal/krew-release-bot@v0.0.43 | |
continue-on-error: true | |
with: | |
krew_template_file: dist/datadog-plugin.yaml |