workflow start #2
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: kubenetmon | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- kubenetmon/** | |
- .github/workflows/kubenetmon.yaml | |
pull_request: | |
paths: | |
- kubenetmon/** | |
- .github/workflows/kubenetmon.yaml | |
jobs: | |
lint-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.23" | |
- name: Install dependencies | |
run: go mod download | |
- name: Run linting | |
run: make lint | |
- name: Run tests | |
run: make test && make integration-test | |
package-docker: | |
needs: lint-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Build Docker image | |
run: | | |
make docker-image | |
docker tag kubenetmon:latest my-docker-repo/kubenetmon:${{ github.sha }} | |
- name: Push Docker image | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USER}" --password-stdin | |
docker push my-docker-repo/kubenetmon:${{ github.sha }} | |
package-helm: | |
needs: lint-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Package Helm chart | |
run: | | |
helm package kubenetmon/deploy/helm -d packaged-charts | |
- name: Push Helm chart | |
env: | |
CHART_REPO_URL: ${{ secrets.CHART_REPO_URL }} | |
CHART_REPO_TOKEN: ${{ secrets.CHART_REPO_TOKEN }} | |
run: | | |
curl -u "token:${CHART_REPO_TOKEN}" \ | |
-F chart=@packaged-charts/kubenetmon-*.tgz \ | |
"${CHART_REPO_URL}" | |
publish: | |
needs: [package-docker, package-helm] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deployment successful | |
run: echo "Docker image and Helm chart published successfully." |