update(charts): refactor #117
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: Build and deploy Bootstrap | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "*.md" | |
- "LICENSE.md" | |
env: | |
NAME: dependencytrack | |
FEATURE_REPOSITORY: oci://europe-north1-docker.pkg.dev/nais-io/nais/feature | |
jobs: | |
go_version: | |
outputs: | |
go_version: ${{ steps.go_version.outputs.GO_VERSION }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Find Go version | |
id: go_version | |
run: | | |
echo "GO_VERSION=$(grep golang .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT | |
tests: | |
needs: | |
- go_version | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ needs.go_version.outputs.go_version }} | |
cache-dependency-path: ./go.sum | |
- name: Run unit tests | |
run: make test | |
- name: run integration tests | |
run: make integration_test | |
build_and_push: | |
outputs: | |
version: ${{ steps.build-push-sign-bootstrap.outputs.version }} | |
needs: | |
- tests | |
permissions: | |
contents: "read" | |
id-token: "write" | |
name: build and push | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/platform-build-push-sign@main | |
id: build-push-sign-bootstrap | |
with: | |
name: ${{ env.NAME }}-bootstrap | |
google_service_account: gh-${{ env.NAME }} | |
workload_identity_provider: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }} | |
push: true | |
- uses: nais/platform-build-push-sign@main | |
id: build-push-sign-resync | |
with: | |
name: ${{ env.NAME }}-resync | |
dockerfile: Dockerfile.resync | |
google_service_account: gh-${{ env.NAME }} | |
workload_identity_provider: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }} | |
push: true | |
- name: Update values.yaml | |
uses: fjogeleit/yaml-update-action@main | |
with: | |
valueFile: "charts/values.yaml" | |
propertyPath: "bootstrap.image.tag" | |
value: ${{ steps.build-push-sign-bootstrap.outputs.version }} | |
commitChange: false | |
- name: Update values.yaml | |
uses: fjogeleit/yaml-update-action@main | |
with: | |
valueFile: "charts/values.yaml" | |
propertyPath: "resync.image.tag" | |
value: ${{ steps.build-push-sign-resync.outputs.version }} | |
commitChange: false | |
- uses: azure/setup-helm@v4 | |
name: "Setup Helm" | |
with: | |
version: "v3.15.2" | |
- name: Build Chart | |
run: |- | |
sed -i "s/^version: .*/version: ${{ steps.build-push-sign-bootstrap.outputs.version }}/g" charts/Chart.yaml | |
helm package charts | |
- name: Push Chart | |
run: |- | |
helm push ${{ env.NAME }}*.tgz ${{ env.FEATURE_REPOSITORY }} | |
rollout: | |
needs: | |
- build_and_push | |
runs-on: fasit-deploy | |
permissions: | |
id-token: write | |
steps: | |
- uses: nais/fasit-deploy@v2 | |
with: | |
chart: ${{ env.FEATURE_REPOSITORY }}/${{ env.NAME }} | |
version: ${{ needs.build_and_push.outputs.version }} |