Deploy to production (ipv4 & ipv6) #48
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: Deploy to production (ipv4 & ipv6) | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
deploy-production-ipv4: | |
name: Deploy ingress(ipv4) to production environment on merge to main branch | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create yaml file from secret | |
id: write_file | |
uses: timheuer/base64-to-file@v1 | |
with: | |
fileName: 'secret.yaml' | |
encodedString: ${{ secrets.DIGDIR_FDK_INGRESS_PROD_IPV4 }} | |
- name: Apply Helm template | |
run: | | |
helm template -f ${{ steps.write_file.outputs.filePath }} \ | |
./helm-sources/ > ./kubectlapply.yaml | |
chmod o+w ./kubectlapply.yaml | |
cat kubectlapply.yaml | |
- name: Auth gcloud CLI for deploy | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.DIGDIR_FDK_PROD_AUTODEPLOY }} | |
- name: Get credentials | |
uses: google-github-actions/get-gke-credentials@v2 | |
with: | |
cluster_name: digdir-fdk-prod | |
location: europe-north1-a | |
- name: Deploy to GCP & check status | |
run: | | |
kubectl apply -f ./kubectlapply.yaml --force | |
- name: Notify slack | |
uses: 8398a7/action-slack@v3 | |
with: | |
mention: 'channel' | |
if_mention: failure | |
status: ${{ job.status }} | |
author_name: 'Application: ingress(ipv4) | Environment: prod' | |
fields: commit,author,workflow,message | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: always() | |
deploy-production-ipv6: | |
name: Deploy ingress(ipv6) to prod environment on merge to main branch | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create yaml file from secret | |
id: write_file | |
uses: timheuer/base64-to-file@v1 | |
with: | |
fileName: 'secret.yaml' | |
encodedString: ${{ secrets.DIGDIR_FDK_INGRESS_PROD_IPV6 }} | |
- name: Apply Helm template | |
run: | | |
helm template -f ${{ steps.write_file.outputs.filePath }} \ | |
./helm-sources/ > ./kubectlapply.yaml | |
chmod o+w ./kubectlapply.yaml | |
cat kubectlapply.yaml | |
- name: Auth gcloud CLI for deploy | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.DIGDIR_FDK_PROD_AUTODEPLOY }} | |
- name: Get credentials | |
uses: google-github-actions/get-gke-credentials@v2 | |
with: | |
cluster_name: digdir-fdk-prod | |
location: europe-north1-a | |
- name: Deploy to GCP & check status | |
run: | | |
kubectl apply -f ./kubectlapply.yaml --force | |
- name: Notify slack | |
uses: 8398a7/action-slack@v3 | |
with: | |
mention: 'channel' | |
if_mention: failure | |
status: ${{ job.status }} | |
author_name: 'Application: ingress(ipv6) | Environment: prod' | |
fields: commit,author,workflow,message | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: always() |