ci: fix docker image tag #10
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: Go CI and Release | |
on: | |
pull_request: | |
branches: | |
- "main" | |
push: | |
branches: | |
- "main" | |
jobs: | |
commitlint: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Commitlint | |
uses: wagoid/commitlint-github-action@v5 | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21.11" | |
- name: Install Operator SDK | |
uses: redhat-actions/openshift-tools-installer@v1 | |
with: | |
source: github | |
operator-sdk: "1.35.0" | |
- name: Check OperatorSDK version | |
run: operator-sdk version | |
- name: Install dependencies | |
run: | | |
go mod download | |
go mod verify | |
- name: Run lint | |
run: make lint | |
build: | |
runs-on: ubuntu-22.04 | |
needs: lint | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21.11" | |
- name: Build | |
run: make build | |
test: | |
runs-on: ubuntu-22.04 | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21.11" | |
- name: Install dependencies | |
run: | | |
go mod download | |
go mod verify | |
- name: Run tests | |
run: make test | |
release: | |
runs-on: ubuntu-22.04 | |
needs: test | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Install semantic-release | |
run: npm install semantic-release@23.0.8 conventional-changelog-conventionalcommits@7.0.2 | |
- name: Run semantic-release | |
id: semantic | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: npx semantic-release | |
- name: Build and push Docker image | |
env: | |
TAG: ${{ steps.semantic.outputs.nextRelease.version }} | |
REGISTRY: ghcr.io | |
run: make docker-build docker-push IMG=${{ env.REGISTRY }}/virtool/operator:${{ env.TAG }} |