Skip to content

Update GitHub Actions #1089

Update GitHub Actions

Update GitHub Actions #1089

Workflow file for this run

name: CI
on:
push:
tags:
- "v*"
branches:
- main
pull_request:
branches:
- "*"
merge_group:
types: [checks_requested]
permissions:
contents: read
env:
IMAGE: "dynatrace/dynatrace-bootstrapper"
REGISTRY: "ghcr.io"
jobs:
tests:
name: Run unit tests
runs-on: ubuntu-latest
if: github.ref_type != 'tag'
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Golang
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: "${{ github.workspace }}/go.mod"
cache: false
- name: Run unit tests and integration tests
id: unittest
run: |
make go/test
linting:
name: Run linting
runs-on: ubuntu-latest
if: github.ref_type != 'tag'
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: "${{ github.workspace }}/go.mod"
cache: false
- name: Run lint
run: |
make go/lint
markdown-lint:
name: Lint markdown files
runs-on: ubuntu-latest
if: github.ref_type != 'tag'
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Lint markdown files
uses: articulate/actions-markdownlint@87f495d21507d6844dc917a01e742eaaa45049c0 # v1.1.0
with:
config: .markdownlint.json
# renovate depName=github.com/igorshubovych/markdownlint-cli
version: v0.49.1
prepare:
name: Prepare properties
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Prepare build parameters
id: prep
run: |
hack/build/ci/prepare-build-variables.sh
outputs:
labels: |
${{ steps.prep.outputs.docker_image_labels }}
vcs-ref=${{ github.sha }}
version: ${{ steps.prep.outputs.docker_image_tag }}
go_linker_args: ${{ steps.prep.outputs.go_linker_args }}
build-push:
name: Build and push images
runs-on: ubuntu-latest
needs: [prepare]
permissions:
packages: write
if: github.repository_owner == 'Dynatrace' && github.event_name != 'merge_group'
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Login to container registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Build and push
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
provenance: false
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ needs.prepare.outputs.version }}
labels: ${{ needs.prepare.outputs.labels }}
build-args: |
GO_LINKER_ARGS=${{ needs.prepare.outputs.go_linker_args }}