v3.2.63 #271
Workflow file for this run
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: Container release | |
on: | |
release: | |
types: [ prereleased, released ] | |
env: | |
ORIGINAL_REPO_NAME: 'newrelic/infrastructure-bundle' | |
jobs: | |
build: | |
name: Build and push image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
# The DOCKER_IMAGE_TAG var is generated here from the release tag, after some validation | |
- name: Generate docker image version from git tag | |
run: | | |
echo "${{ github.event.release.tag_name }}" | grep -E '^[v]?[0-9.]*[0-9]$' | |
DOCKER_IMAGE_TAG=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//') | |
echo "DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG" >> $GITHUB_ENV | |
# On prereleases, "-rc" is appended to DOCKER_IMAGE_TAG | |
- if: ${{ github.event.release.prerelease }} | |
run: | | |
echo "DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG}-rc" >> $GITHUB_ENV | |
# Download integrations | |
- name: Download integrations | |
run: go run downloader.go | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.OHAI_DOCKER_HUB_ID }} | |
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }} | |
- name: Build and push versioned docker image | |
run: ./docker-build.sh . --push | |
- name: Build and push :latest docker image | |
if: ${{ ! github.event.release.prerelease }} | |
env: | |
DOCKER_IMAGE_TAG: latest | |
run: ./docker-build.sh . --push | |
- if: ${{ github.event.release.prerelease }} | |
uses: actions/checkout@v4 | |
- if: ${{ github.event.release.prerelease }} | |
name: Update title for successful pre-release | |
env: | |
GH_TOKEN: "${{ secrets.COREINT_BOT_TOKEN }}" | |
run: | | |
gh release edit ${{ github.event.release.tag_name }} --title "${{ github.event.release.tag_name }}" | |
notify-failure: | |
if: ${{ always() && failure() }} | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify failure via Slack | |
uses: archive/github-actions-slack@master | |
with: | |
slack-bot-user-oauth-access-token: ${{ secrets.COREINT_SLACK_TOKEN }} | |
slack-channel: ${{ secrets.CAOS_COREINT_SLACK_CHANNEL }} | |
slack-text: "❌ `${{ env.ORIGINAL_REPO_NAME }}`: [release pipeline failed](${{ github.server_url }}/${{ env.ORIGINAL_REPO_NAME }}/actions/runs/${{ github.run_id }})." | |
update-release-title-on-failure: | |
if: ${{ always() && failure() }} | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- if: ${{ github.event.release.prerelease }} | |
name: Reflect failure in pre-release title | |
env: | |
GH_TOKEN: "${{ secrets.COREINT_BOT_TOKEN }}" | |
run: | | |
gh release edit ${{ github.event.release.tag_name }} --title "${{ github.event.release.tag_name }} (pre-release-failure)" | |
- if: ${{ ! github.event.release.prerelease }} | |
name: Reflect failure in release title | |
env: | |
GH_TOKEN: "${{ secrets.COREINT_BOT_TOKEN }}" | |
run: | | |
gh release edit ${{ github.event.release.tag_name }} --title "${{ github.event.release.tag_name }} (release-failure)" |