|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + tags: |
| 8 | + - "v*.*.*" |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - master |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + packages: read |
| 16 | + |
| 17 | +jobs: |
| 18 | + test: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up Go |
| 25 | + uses: actions/setup-go@v5 |
| 26 | + with: |
| 27 | + go-version: "1.25" |
| 28 | + cache: true |
| 29 | + |
| 30 | + - name: Run go vet |
| 31 | + run: go vet ./... |
| 32 | + |
| 33 | + - name: Run tests |
| 34 | + run: go test -race -coverprofile=coverage.txt -covermode=atomic ./... |
| 35 | + |
| 36 | + - name: Upload coverage to Codecov |
| 37 | + uses: codecov/codecov-action@v4 |
| 38 | + with: |
| 39 | + file: ./coverage.txt |
| 40 | + fail_ci_if_error: false |
| 41 | + verbose: true |
| 42 | + |
| 43 | + helm-lint: |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@v4 |
| 48 | + |
| 49 | + - name: Set up Helm |
| 50 | + uses: azure/setup-helm@v4 |
| 51 | + with: |
| 52 | + version: v3.16.0 |
| 53 | + |
| 54 | + - name: Lint Helm Chart |
| 55 | + run: | |
| 56 | + helm lint deploy/cert-manager-alidns-webhook |
| 57 | +
|
| 58 | + docker-release: |
| 59 | + if: startsWith(github.ref, 'refs/tags/v') |
| 60 | + needs: [test, helm-lint] |
| 61 | + uses: ./.github/workflows/docker-release.yaml |
| 62 | + secrets: inherit |
| 63 | + permissions: |
| 64 | + contents: write |
| 65 | + packages: write |
| 66 | + id-token: write |
| 67 | + |
| 68 | + helm-release: |
| 69 | + if: startsWith(github.ref, 'refs/tags/v') |
| 70 | + needs: [test, helm-lint] |
| 71 | + uses: ./.github/workflows/helm-release.yaml |
| 72 | + secrets: inherit |
| 73 | + permissions: |
| 74 | + contents: write |
| 75 | + packages: write |
| 76 | + id-token: write |
| 77 | + |
| 78 | + create-release: |
| 79 | + if: startsWith(github.ref, 'refs/tags/v') |
| 80 | + needs: [docker-release, helm-release] |
| 81 | + runs-on: ubuntu-latest |
| 82 | + permissions: |
| 83 | + contents: write |
| 84 | + steps: |
| 85 | + - name: Create GitHub Release |
| 86 | + uses: softprops/action-gh-release@v2 |
| 87 | + with: |
| 88 | + body: | |
| 89 | + ## Docker Image |
| 90 | +
|
| 91 | + ```bash |
| 92 | + docker pull ghcr.io/crazygit/cert-manager-alidns-webhook:${{ github.ref_name }} |
| 93 | + ``` |
| 94 | +
|
| 95 | + ## Helm Chart |
| 96 | +
|
| 97 | + ```bash |
| 98 | + helm install cert-manager-alidns-webhook oci://ghcr.io/crazygit/helm-charts/cert-manager-alidns-webhook --version ${{ github.ref_name }} |
| 99 | + ``` |
| 100 | + env: |
| 101 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments