fix(deps): update go dependencies #1172
This file contains 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: Controller Package CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
dryRun: | |
description: 'Dry-Run' | |
default: 'true' | |
required: false | |
env: | |
# Currently no way to detect automatically | |
DEFAULT_BRANCH: main | |
GO_VERSION: 1.21 # renovate: datasource=golang-version depName=golang | |
NODE_VERSION: 18 | |
DRY_RUN: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# full checkout for semantic-release | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Set up go ${{env.GO_VERSION}} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{env.GO_VERSION}} | |
- | |
name: Tests | |
run: | | |
go mod tidy | |
go test -v ./... | |
release: | |
needs: [build] | |
if: github.repository == 'ibm-hyper-protect/k8s-operator-hpcr' && github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
packages: write | |
steps: | |
# full checkout for semantic-release | |
- name: Full checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Set up go ${{env.GO_VERSION}} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{env.GO_VERSION}} | |
- name: Install goreleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: latest | |
install-only: true | |
# The dry-run evaluation is only made for non PR events. Manual trigger w/dryRun true, main branch and any tagged branches will set DRY run to false | |
- name: Check dry run | |
run: | | |
if [[ "${{github.event_name}}" == "workflow_dispatch" && "${{ github.event.inputs.dryRun }}" != "true" ]]; then | |
echo "DRY_RUN=false" >> $GITHUB_ENV | |
elif [[ "${{github.ref}}" == "refs/heads/${{env.DEFAULT_BRANCH}}" ]]; then | |
echo "DRY_RUN=false" >> $GITHUB_ENV | |
elif [[ "${{github.ref}}" =~ ^refs/heads/v[0-9]+(\.[0-9]+)?$ ]]; then | |
echo "DRY_RUN=false" >> $GITHUB_ENV | |
fi | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: amd64,s390x,arm64 | |
- name: Docker Login | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Semantic Release | |
run: | | |
npx -p @semantic-release/changelog -p @semantic-release/exec -p @semantic-release/git -p conventional-changelog-conventionalcommits semantic-release --dry-run ${{env.DRY_RUN}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |