chore(charts): Run 2 replicas #64
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 | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "*.md" | |
env: | |
NAME: fqdn-policy | |
FEATURE_REPOSITORY: oci://europe-north1-docker.pkg.dev/nais-io/nais/feature | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: jdx/mise-action@v2 | |
- name: Find go cache dir | |
id: go-cache | |
run: | | |
go version | |
# Clear cache dirs to avoid error when restoring | |
go clean -cache -modcache | |
echo "gocache=$(go env GOCACHE)" >> $GITHUB_OUTPUT | |
echo "gomodcache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | |
- name: Cache go modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.go-cache.outputs.gocache }} | |
${{ steps.go-cache.outputs.gomodcache }} | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- run: make test | |
- run: make check | |
build_and_push: | |
outputs: | |
version: ${{ steps.build-push-sign.outputs.version }} | |
needs: | |
- tests | |
permissions: | |
contents: "read" | |
id-token: "write" | |
packages: "write" | |
name: build and push | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: jdx/mise-action@v2 | |
- id: go_version | |
run: echo "go_version=$(mise current go)" >> $GITHUB_OUTPUT | |
- uses: nais/platform-build-push-sign@main | |
id: build-push-sign | |
with: | |
name: ${{ env.NAME }} | |
google_service_account: gh-${{ env.NAME }} | |
workload_identity_provider: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }} | |
push: true | |
push_ghcr: true | |
build_args: | | |
GO_VERSION=${{ steps.go_version.outputs.go_version }} | |
- name: Update values.yaml | |
uses: fjogeleit/yaml-update-action@main | |
with: | |
valueFile: "charts/values.yaml" | |
propertyPath: "image.tag" | |
value: ${{ steps.build-push-sign.outputs.version }} | |
commitChange: false | |
- name: Build Chart | |
run: |- | |
sed -i "s/^version: .*/version: ${{ steps.build-push-sign.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 }} |