From b6d861b9664102b3b1acd10a9e3e2a92e7bad54a Mon Sep 17 00:00:00 2001 From: Jay Danielsen Date: Thu, 10 Oct 2024 15:30:11 -0400 Subject: [PATCH] build and publish docker image in docker.artifacory.brandwatch.com --- .github/workflows/build-deploy-pipeline.yaml | 59 ++++++++++++++++++++ .github/workflows/release.yml | 56 ------------------- 2 files changed, 59 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/build-deploy-pipeline.yaml delete mode 100644 .github/workflows/release.yml 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}}