Skip to content

Commit d9662ee

Browse files
committed
ci: add a draft of diff-to-us and deploy-to-us
1 parent 568a4ad commit d9662ee

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/std.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ on:
1313
branches:
1414
- master
1515
- conway-era
16+
- dev-preview
1617
push:
1718
branches:
1819
- master
1920
- conway-era
21+
- dev-preview
2022
tags:
2123
- '@cardano-sdk/cardano-services**'
2224
env:
@@ -96,3 +98,80 @@ jobs:
9698
echo commit: ${{ github.sha }}
9799
- uses: divnix/std-action/run@main
98100
with: {ffBuildInstructions: true, remoteStore: "ssh-ng://eu.nixbuild.net"}
101+
102+
### FIXME:
103+
### FIXME: change all instances of `dev-preview` in `diff-to-us` back to `${{ github.ref_name }}`
104+
### FIXME:
105+
106+
diff-to-us:
107+
needs: images
108+
name: Comment with a Plan Diff (${{ github.ref_name }})
109+
if: github.event_name == 'pull_request' && (github.ref_name == 'dev-preview' || github.ref_name == 'chore/LW-9879-lace-ops-to-sdk')
110+
runs-on: ubuntu-22.04
111+
steps:
112+
- uses: actions/checkout@v4
113+
114+
- uses: DeterminateSystems/nix-installer-action@main
115+
116+
- name: Configure AWS Credentials
117+
uses: aws-actions/[email protected]
118+
with:
119+
role-to-assume: ${{ env.AWS_ROLE_ARN }}
120+
aws-region: ${{ env.AWS_REGION }}
121+
122+
- name: Generate the Diff
123+
run: |
124+
nix develop -L --command bash -c '
125+
set -euo pipefail
126+
127+
nix run -L ".#[email protected]" 2&1 \
128+
| tee plan-diff.txt
129+
'
130+
131+
- name: Post Comment on the PR
132+
uses: actions/github-script@v5
133+
with:
134+
script: |
135+
const fs = require('fs');
136+
const output = fs.readFileSync('plan-diff.txt', 'utf8');
137+
github.rest.issues.createComment({
138+
issue_number: context.issue.number,
139+
owner: context.repo.owner,
140+
repo: context.repo.repo,
141+
body: output,
142+
});
143+
144+
145+
deploy-to-us:
146+
if: github.ref_name == 'dev-preview'
147+
# TODO: if: github.ref_name == 'dev-preview' || github.ref_name == 'chore/LW-9879-lace-ops-to-sdk'
148+
needs: [images, diff-to-us]
149+
concurrency:
150+
# Only one deployment at a time per environment, and wait for the previous one to finish:
151+
group: deploy-${{ github.ref_name }}
152+
cancel-in-progress: false
153+
name: Deploy (${{ github.ref_name }})
154+
runs-on: ubuntu-22.04
155+
environment:
156+
name: ${{ github.ref_name }}
157+
url: https://${{ github.ref_name }}.dapps.lw.iog.io/
158+
steps:
159+
- uses: actions/checkout@v4
160+
161+
- uses: DeterminateSystems/nix-installer-action@main
162+
163+
- name: Configure AWS Credentials
164+
uses: aws-actions/[email protected]
165+
with:
166+
role-to-assume: ${{ env.AWS_ROLE_ARN }}
167+
aws-region: ${{ env.AWS_REGION }}
168+
169+
- name: Deploy to K8s
170+
run: |
171+
echo "Will deploy ‘${{ github.sha }}’ to ‘${{ github.ref_name }}’"
172+
173+
nix develop -L --command bash -c '
174+
set -euo pipefail
175+
176+
echo yes | nix run -L ".#helm.x86_64-linux.${{ github.ref_name }}@us-east-1.apply"
177+
'

0 commit comments

Comments
 (0)