-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
86 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,86 @@ | ||
name: "Promote dev to production" | ||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
env: | ||
RADIX_APP: dm-demos | ||
RADIX_USER: [email protected] | ||
|
||
jobs: | ||
deploy-on-radix: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
# You'll need an app registration with a Federated Credential for this to | ||
# work. Note that the credential will need to specify a branch name. This | ||
# step will therefore fail for all branches not mentioned in the credentials | ||
- name: Az CLI login | ||
uses: azure/login@v1 | ||
with: | ||
client-id: 9bc1cfd7-c616-45d2-8827-22ae9d1e0567 # app registration Application ID | ||
tenant-id: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0 | ||
allow-no-subscriptions: true | ||
|
||
- name: Get Azure principal token for Radix | ||
# The resource 6dae42f8-4368-4678-94ff-3960e28e3630 is a fixed Application ID, | ||
# corresponding to the Azure Kubernetes Service AAD Server. | ||
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: Promote | ||
uses: equinor/radix-github-actions@master | ||
env: | ||
APP_SERVICE_ACCOUNT_TOKEN: ${{ env.APP_SERVICE_ACCOUNT_TOKEN }} | ||
with: | ||
args: > | ||
create job | ||
promote | ||
--application dm-demos | ||
--from-environment dev | ||
--to-environment prod | ||
--use-active-deployment | ||
- name: Get Azure principal token for Azure application | ||
run: | | ||
token=$(az account get-access-token --resource 9bc1cfd7-c616-45d2-8827-22ae9d1e0567 --query=accessToken -otsv) | ||
echo "::add-mask::$token" | ||
echo "RESET_APP_TOKEN=$token" >> $GITHUB_ENV | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dm-cli | ||
working-directory: ./example | ||
run: pip install -r requirements.txt | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-example-node-modules | ||
with: | ||
path: ./example/node_modules | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./example/package.json')}} | ||
|
||
- name: Install dependencies | ||
working-directory: ./example | ||
run: yarn install | ||
|
||
- name: Reset application | ||
working-directory: ./example | ||
env: | ||
RESET_APP_TOKEN: ${{ env.RESET_APP_TOKEN }} | ||
run: | | ||
sleep 30 # Wait for the services to be restarted | ||
./reset-app.sh prod ${{ env.RESET_APP_TOKEN }} |