v2.20.1 #39
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@v4 | |
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@v4 | |
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 }} | |
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 }})." |