Merge pull request #52 from Starosdev/develop #13
This file contains hidden or 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: | |
| - master | |
| - beta | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| name: Semantic Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_release_published: ${{ steps.semantic.outputs.new_release_published }} | |
| new_release_version: ${{ steps.semantic.outputs.new_release_version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: | | |
| npm install -g \ | |
| semantic-release \ | |
| @semantic-release/commit-analyzer \ | |
| @semantic-release/release-notes-generator \ | |
| @semantic-release/changelog \ | |
| @semantic-release/exec \ | |
| @semantic-release/git \ | |
| @semantic-release/github \ | |
| conventional-changelog-conventionalcommits | |
| - name: Semantic Release | |
| id: semantic | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }} | |
| run: npx semantic-release | |
| build: | |
| name: Build Binaries | |
| needs: release | |
| if: needs.release.outputs.new_release_published == 'true' | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/packagrio/packagr:latest-golang | |
| services: | |
| influxdb: | |
| image: influxdb:2.2 | |
| env: | |
| DOCKER_INFLUXDB_INIT_MODE: setup | |
| DOCKER_INFLUXDB_INIT_USERNAME: admin | |
| DOCKER_INFLUXDB_INIT_PASSWORD: password12345 | |
| DOCKER_INFLUXDB_INIT_ORG: scrutiny | |
| DOCKER_INFLUXDB_INIT_BUCKET: metrics | |
| DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: my-super-secret-auth-token | |
| ports: | |
| - 8086:8086 | |
| env: | |
| STATIC: true | |
| strategy: | |
| matrix: | |
| cfg: | |
| - { goos: linux, goarch: amd64 } | |
| - { goos: linux, goarch: arm, goarm: 5 } | |
| - { goos: linux, goarch: arm, goarm: 6 } | |
| - { goos: linux, goarch: arm, goarm: 7 } | |
| - { goos: linux, goarch: arm64 } | |
| - { goos: darwin, goarch: amd64 } | |
| - { goos: darwin, goarch: arm64 } | |
| - { goos: freebsd, goarch: amd64 } | |
| - { goos: windows, goarch: amd64 } | |
| - { goos: windows, goarch: arm64 } | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: v${{ needs.release.outputs.new_release_version }} | |
| - name: Build Binaries | |
| env: | |
| GOOS: ${{ matrix.cfg.goos }} | |
| GOARCH: ${{ matrix.cfg.goarch }} | |
| GOARM: ${{ matrix.cfg.goarm }} | |
| run: make binary-clean binary-all | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries-${{ matrix.cfg.goos }}-${{ matrix.cfg.goarch }}${{ matrix.cfg.goarm }} | |
| path: | | |
| scrutiny-web-* | |
| scrutiny-collector-metrics-* | |
| upload-assets: | |
| name: Upload Release Assets | |
| needs: [release, build] | |
| if: needs.release.outputs.new_release_published == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: binaries-* | |
| merge-multiple: true | |
| - name: List files | |
| run: ls -la | |
| - name: Upload to release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }} | |
| run: | | |
| VERSION="v${{ needs.release.outputs.new_release_version }}" | |
| for file in scrutiny-*; do | |
| if [ -f "$file" ]; then | |
| echo "Uploading $file..." | |
| gh release upload "$VERSION" "$file" --repo ${{ github.repository }} --clobber | |
| fi | |
| done |