diff --git a/.github/workflows/build-deploy-pipeline.yaml b/.github/workflows/build-deploy-pipeline.yaml new file mode 100644 index 0000000..f3439b4 --- /dev/null +++ b/.github/workflows/build-deploy-pipeline.yaml @@ -0,0 +1,59 @@ +name: Build, Deploy pipeline + +permissions: + checks: write + contents: read +on: + push: + branches: + - main + - master + +jobs: + release: + runs-on: ubuntu-latest + name: Release + steps: + - name: Set up Go 1.13 + uses: actions/setup-go@v5 + with: + go-version: 1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + + - name: Get dependencies + run: go mod download + + - name: Test + run: go test ./... + + - name: Build + run: make release + + - name: Upload + run: | + ./upload.sh ./bin/script_exporter-darwin-amd64 application/x-binary + ./upload.sh ./bin/script_exporter-linux-amd64 application/x-binary + ./upload.sh ./bin/script_exporter-linux-armv7 application/x-binary + ./upload.sh ./bin/script_exporter-linux-arm64 application/x-binary + ./upload.sh ./bin/script_exporter-windows-amd64.exe application/x-binary + env: + GITHUB_TOKEN: ${{ secrets.TOKEN }} + + - name: Build image + uses: Brandwatch/bw-workflow-actions/steps/generic/dockerfile-image@production + with: + images: ${{ github.event.repository.name }} + tag: ${{ github.ref_name }}-${{ github.run_id }} + brandwatch-artifactory-docker-push-password: ${{ secrets.ARTIFACTORY_DOCKER_PUSH_PASSWORD }} + cpu-architectures: amd64 + + - name: Scan And Push Image + uses: Brandwatch/bw-workflow-actions/steps/generic/scan-and-push-image@production + with: + artifactory-pwd: ${{ secrets.ARTIFACTORY_DOCKER_PUSH_PASSWORD }} + images: ${{ github.event.repository.name }} + tag: ${{ github.ref_name }}-${{ github.run_id }} + trivy-kill-key: ${{ secrets.TRIVY_KILL_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 9ac6c24..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Release - -on: - release: - types: [created] - -jobs: - release: - runs-on: ubuntu-latest - name: Release - steps: - - name: Set up Go 1.13 - uses: actions/setup-go@v1 - with: - go-version: 1.13 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Get dependencies - run: go mod download - - - name: Test - run: go test ./... - - - name: Build - run: make release - - - name: Upload - run: | - ./upload.sh ./bin/script_exporter-darwin-amd64 application/x-binary - ./upload.sh ./bin/script_exporter-linux-amd64 application/x-binary - ./upload.sh ./bin/script_exporter-linux-armv7 application/x-binary - ./upload.sh ./bin/script_exporter-linux-arm64 application/x-binary - ./upload.sh ./bin/script_exporter-windows-amd64.exe application/x-binary - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} - - docker: - name: Push Docker Image - runs-on: ubuntu-latest - steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Set Docker Tag - run: echo ::set-env name=DOCKER_TAG::${GITHUB_REF/refs\/tags\//} - - - name: Docker Build and Push - uses: docker/build-push-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: ricoberger/script_exporter - tags: ${{env.DOCKER_TAG}}