|
| 1 | +name: Create Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +env: |
| 9 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v2 |
| 16 | + - name: Install packages |
| 17 | + run: | |
| 18 | + sudo apt-get update |
| 19 | + sudo apt-get install -y \ |
| 20 | + indent |
| 21 | + - name: Lint |
| 22 | + id: lint |
| 23 | + run: make lint |
| 24 | + |
| 25 | + - uses: act10ns/slack@v1 |
| 26 | + with: |
| 27 | + status: ${{ job.status }} |
| 28 | + steps: ${{ toJson(steps) }} |
| 29 | + if: failure() |
| 30 | + |
| 31 | + release: |
| 32 | + needs: test |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v2 |
| 36 | + - name: Install dependencies |
| 37 | + run: | |
| 38 | + sudo apt-get update |
| 39 | + sudo apt-get -y install \ |
| 40 | + libjansson-dev \ |
| 41 | + libcurl4-openssl-dev |
| 42 | + - name: Build artifacts |
| 43 | + id: build-nagios3 |
| 44 | + run: | |
| 45 | + make nagios3 |
| 46 | + mv src/alerta-neb.o src/alerta-neb.o.nagios3 |
| 47 | + - name: Build artifacts |
| 48 | + id: build-nagios4 |
| 49 | + run: | |
| 50 | + make nagios4 |
| 51 | + mv src/alerta-neb.o src/alerta-neb.o.nagios4 |
| 52 | + - name: Build artifacts |
| 53 | + id: build-naemon |
| 54 | + run: | |
| 55 | + make naemon |
| 56 | + mv src/alerta-neb.o src/alerta-neb.o.naemon |
| 57 | + - name: Create Release |
| 58 | + id: create-release |
| 59 | + uses: actions/create-release@v1 |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + with: |
| 63 | + tag_name: ${{ github.ref }} |
| 64 | + release_name: Release ${{ github.ref }} |
| 65 | + draft: false |
| 66 | + prerelease: false |
| 67 | + - name: Upload Nagios 3 NEB Module |
| 68 | + id: upload-module-nagios3 |
| 69 | + uses: actions/upload-release-asset@v1 |
| 70 | + env: |
| 71 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + with: |
| 73 | + upload_url: ${{ steps.create-release.outputs.upload_url }} |
| 74 | + asset_path: ./src/alerta-neb.o.nagios3 |
| 75 | + asset_name: alerta-neb.o.nagios3 |
| 76 | + asset_content_type: application/octet-stream |
| 77 | + - name: Upload Nagios 4 NEB Module |
| 78 | + id: upload-module-nagios4 |
| 79 | + uses: actions/upload-release-asset@v1 |
| 80 | + env: |
| 81 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + with: |
| 83 | + upload_url: ${{ steps.create-release.outputs.upload_url }} |
| 84 | + asset_path: ./src/alerta-neb.o.nagios4 |
| 85 | + asset_name: alerta-neb.o.nagios4 |
| 86 | + asset_content_type: application/octet-stream |
| 87 | + - name: Upload Naemon NEB Module |
| 88 | + id: upload-module-naemon |
| 89 | + uses: actions/upload-release-asset@v1 |
| 90 | + env: |
| 91 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + with: |
| 93 | + upload_url: ${{ steps.create-release.outputs.upload_url }} |
| 94 | + asset_path: ./src/alerta-neb.o.naemon |
| 95 | + asset_name: alerta-neb.o.naemon |
| 96 | + asset_content_type: application/octet-stream |
| 97 | + |
| 98 | + - uses: act10ns/slack@v1 |
| 99 | + with: |
| 100 | + status: ${{ job.status }} |
| 101 | + steps: ${{ toJson(steps) }} |
| 102 | + # if: failure() |
0 commit comments