v2.21.5 #52
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: Release integration pipeline | |
on: | |
release: | |
types: | |
- prereleased | |
- released | |
tags: | |
- 'v*' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
INTEGRATION: "prometheus" | |
ORIGINAL_REPO_NAME: 'newrelic/nri-prometheus' | |
REPO_FULL_NAME: ${{ github.event.repository.full_name }} | |
TAG: ${{ github.event.release.tag_name }} | |
S3_PATH: s3://nr-downloads-main/infrastructure_agent | |
TAG_SUFFIX: "" # This suffix is used for pre-release only | |
jobs: | |
test-nix: | |
name: Run unit tests on *Nix | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Unit tests | |
run: make ci/test | |
test-windows: | |
name: Run unit tests on Windows | |
runs-on: windows-latest | |
env: | |
GOPATH: ${{ github.workspace }} | |
defaults: | |
run: | |
working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
path: src/github.com/${{env.ORIGINAL_REPO_NAME}} | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'src/github.com/${{ env.ORIGINAL_REPO_NAME }}/go.mod' | |
- name: Running unit tests | |
shell: pwsh | |
run: | | |
.\build\windows\unit_tests.ps1 | |
integration-release: | |
name: Use goreleaser for releasing | |
runs-on: ubuntu-latest | |
needs: [ test-nix, test-windows ] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.FSI_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.FSI_DOCKERHUB_TOKEN }} | |
- name: Add pre-release tag | |
if: ${{ github.event.release.prerelease }} | |
run: | | |
echo "TAG_SUFFIX=-pre" >> $GITHUB_ENV | |
- name: do the release | |
# The release target is not being executed inside a container (ci/release) since the target | |
# compiles docker images (from goreleaser) and that cannot be done inside a container. | |
run: make release | |
env: | |
GENERATE_PACKAGES: true | |
UPLOAD_PACKAGES: ${{ github.event.release.prerelease }} | |
- 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: [test-nix, test-windows, integration-release] | |
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.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: [test-nix, test-windows, integration-release] | |
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)" |