-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ 👷 ability to deploy to radix from github
- Loading branch information
Showing
5 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: 🛠️ Radix Build & Deploy | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment-name: | ||
description: "The GitHub environment to use this workflow in" | ||
type: string | ||
required: true | ||
secrets: | ||
webhook-url: | ||
required: true | ||
jobs: | ||
build: | ||
environment: | ||
name: ${{ inputs.environment-name }} | ||
name: 🛠️ Build & Deploy | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- name: Login Azure | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{ vars.CLIENT_ID }} | ||
tenant-id: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0 | ||
allow-no-subscriptions: true | ||
- name: Get token | ||
run: | | ||
token=$(az account get-access-token --resource 6dae42f8-4368-4678-94ff-3960e28e3630 --query=accessToken -otsv) | ||
echo "::add-mask::$token" | ||
echo "APP_SERVICE_ACCOUNT_TOKEN=$token" >> $GITHUB_ENV | ||
- name: Create build-deploy pipeline | ||
uses: equinor/radix-github-actions@v1 | ||
with: | ||
args: > | ||
create pipeline-job | ||
build-deploy | ||
--application ${{ vars.RADIX_APPLICATION_NAME }} | ||
--branch ${{ github.event.repository.default_branch }} | ||
--follow | ||
--token-environment | ||
notify: | ||
name: Notify on slack | ||
needs: [build] | ||
uses: ./.github/workflows/notify.yaml | ||
with: | ||
environment-name: ${{ inputs.environment-name }} | ||
secrets: | ||
webhook-url: ${{ secrets.webhook-url }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: 💬 Notify | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment-name: | ||
type: string | ||
required: true | ||
secrets: | ||
webhook-url: | ||
required: true | ||
jobs: | ||
slack_notification: | ||
name: 💬 Slack notification | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Notify | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"text": "🚀 New version deployed", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "🚀 ${{ vars.RADIX_APPLICATION_NAME }} - Deployed new version to ${{ inputs.environment-name }}" | ||
} | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.webhook-url }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: 📣 Promote | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment-name: | ||
description: "The GitHub environment to use this workflow in" | ||
type: string | ||
required: true | ||
from-environment: | ||
description: "The Radix environment to promote from" | ||
type: string | ||
required: true | ||
to-environment: | ||
description: "The Radix environment to promote to" | ||
type: string | ||
required: true | ||
secrets: | ||
webhook-url: | ||
required: true | ||
jobs: | ||
promote: | ||
environment: | ||
name: ${{ inputs.environment-name }} | ||
name: 📣 Promote | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- name: Login Azure | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{ vars.CLIENT_ID }} | ||
tenant-id: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0 | ||
allow-no-subscriptions: true | ||
- name: Get token | ||
run: | | ||
token=$(az account get-access-token --resource 6dae42f8-4368-4678-94ff-3960e28e3630 --query=accessToken -otsv) | ||
echo "::add-mask::$token" | ||
echo "APP_SERVICE_ACCOUNT_TOKEN=$token" >> $GITHUB_ENV | ||
- name: Create build-deploy pipeline | ||
uses: equinor/radix-github-actions@v1 | ||
with: | ||
args: > | ||
create pipeline-job | ||
promote | ||
--application ${{ vars.RADIX_APPLICATION_NAME }} | ||
--follow | ||
--from-environment ${{ inputs.from-environment }} | ||
--to-environment ${{ inputs.to-environment }} | ||
--token-environment | ||
--use-active-deployment | ||
notify: | ||
name: Notify on slack | ||
needs: [promote] | ||
uses: ./.github/workflows/notify.yaml | ||
with: | ||
environment-name: ${{ inputs.environment-name }} | ||
secrets: | ||
webhook-url: ${{ secrets.webhook-url }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Push | ||
on: | ||
push: | ||
branch: [main] | ||
workflow_dispatch: | ||
jobs: | ||
lint: | ||
name: 🚑 Lint | ||
uses: ./.github/workflows/lint.yaml | ||
test: | ||
name: 🧪 Test | ||
uses: ./.github/workflows/test.yaml | ||
build_deploy_dev: | ||
name: 🛠️ Build and 🚀 Deploy development to radix | ||
needs: [test, lint] | ||
uses: ./.github/workflows/build_deploy_radix.yaml | ||
with: | ||
environment-name: development | ||
secrets: | ||
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
deploy_staging: | ||
name: 🚀 Promote to staging | ||
needs: [build_deploy_dev] | ||
uses: ./.github/workflows/promote.yaml | ||
with: | ||
environment-name: staging | ||
from-environment: development | ||
to-environment: staging | ||
secrets: | ||
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
deploy_production: | ||
name: 🚀 Promote to production | ||
needs: [deploy_staging] | ||
uses: ./.github/workflows/promote.yaml | ||
with: | ||
environment-name: production | ||
from-environment: staging | ||
to-environment: production | ||
secrets: | ||
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
https://raw.githubusercontent.com/equinor/amplify-components/main/config/config_files/workflows/build_deploy_radix.yaml | ||
https://raw.githubusercontent.com/equinor/amplify-components/main/config/config_files/workflows/promote.yaml | ||
https://raw.githubusercontent.com/equinor/amplify-components/main/config/config_files/workflows/notify.yaml | ||
https://raw.githubusercontent.com/equinor/amplify-components/main/config/config_files/workflows/push.yaml |