-
-
Notifications
You must be signed in to change notification settings - Fork 108
210 lines (179 loc) · 6.98 KB
/
demo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: Demo
on:
workflow_dispatch:
pull_request:
types: [labeled, opened, synchronize]
paths:
- ".github/workflows/demo.yml"
permissions:
contents: read
id-token: write
pull-requests: write
env:
TERM: "xterm-256color"
COLORTERM: "truecolor"
LANG: "en_US.UTF-8"
ATMOS_LOGS_LEVEL: "Info"
TERRAFORM_VERSION: "1.9.7"
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Atmos version
id: get-version
run: |
VERSION=$(curl -s https://api.github.com/repos/cloudposse/atmos/releases/latest | jq -r .tag_name)
echo "version=$VERSION" >> $GITHUB_OUTPUT
outputs:
version: ${{ steps.get-version.outputs.version }}
screengrabs:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y aha util-linux make jq bat
sudo ln -s /usr/bin/batcat /usr/bin/bat
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Atmos
uses: jaxxstorm/[email protected]
with:
repo: cloudposse/atmos
tag: ${{ needs.prepare.outputs.version }}
chmod: 0755
extension-matching: disable
rename-to: atmos
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false
- name: Run make build-all install
run: |
make -C demo/screengrabs build-all install
git add -A
git status
- name: Create or update PR
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: "chore/update-build-screengrabs-for-${{ needs.prepare.outputs.version }}"
title: "Update screengrabs for ${{ needs.prepare.outputs.version }}"
delete-branch: true
sign-commits: true
commit-message: |
chore: update screengrabs for ${{ needs.prepare.outputs.version }}
body: |
This PR updates the screengrabs for Atmos version ${{ needs.prepare.outputs.version }}.
base: main
labels: "no-release"
vhs:
needs: [prepare]
runs-on: ubuntu-latest
timeout-minutes: 120
environment: demo
env:
AWS_REGION: us-east-2
IAM_ROLE_ARN: arn:aws:iam::068007702576:role/cplive-plat-ue2-dev-atmos-docs-gha
IAM_ROLE_SESSION_NAME: cloudposse-atmos-ci-deploy-${{ github.run_id }}
S3_BUCKET_NAME: cplive-plat-ue2-dev-atmos-docs-origin
steps:
# https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ env.IAM_ROLE_ARN }}
role-session-name: ${{ env.IAM_ROLE_SESSION_NAME }}
- name: Test AWS
run: |
aws sts get-caller-identity
- uses: actions/create-github-app-token@v1
id: github-app
with:
app-id: ${{ vars.BOT_GITHUB_APP_ID }}
private-key: ${{ secrets.BOT_GITHUB_APP_PRIVATE_KEY }}
owner: cloudposse-corp
repositories: assets
- uses: actions/checkout@v4
- name: Checkout cloudposse-corp/assets
uses: actions/checkout@v4
with:
repository: cloudposse-corp/assets
token: ${{ steps.github-app.outputs.token }}
path: assets
- name: Install audio track
run: |
cp assets/artlist/background-1.mp3 demo/recordings/background.mp3
- name: Set Swap Space
uses: pierotofy/set-swap-space@0404882bc4666c0ff2f6fd8b3d32af69a730183c
with:
swap-size-gb: 15
- name: Install Atmos
uses: jaxxstorm/[email protected]
with:
repo: cloudposse/atmos
tag: ${{ needs.prepare.outputs.version }}
chmod: 0755
extension-matching: disable
rename-to: atmos
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false
- name: Test Atmos
run: |
which atmos
atmos version
atmos --help
- name: Prepare variables
id: vars
run: |
VERSION="${{ needs.prepare.outputs.version }}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "job_name=${JOB_NAME}" >> $GITHUB_OUTPUT
echo "branch_name=chore/update-${JOB_NAME}-for-${VERSION}" >> $GITHUB_OUTPUT
- name: Setup VHS
uses: charmbracelet/vhs-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
install-fonts: true
- name: Record screencast
run: |
demo/recordings/build.sh
mv demo/recordings/gif/atmos.gif docs/demo.gif
- name: Copy Website to S3 Bucket PR Folder
run: |
cd demo/recordings
aws s3 ls s3://${{ env.S3_BUCKET_NAME }}
#aws s3 sync . s3://${{ env.S3_BUCKET_NAME }}/assets/mp4/
#aws s3 ls s3://${{ env.S3_BUCKET_NAME }}/assets/mp4/ --recursive --human-readable --summarize
#aws s3 sync . s3://${{ env.S3_BUCKET_NAME }}/assets/gif/
#aws s3 ls s3://${{ env.S3_BUCKET_NAME }}/assets/gif/ --recursive --human-readable --summarize
- name: Create or update PR
uses: peter-evans/create-pull-request@v7
id: auto-commit
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.vars.outputs.branch_name }}
sign-commits: true
commit-message: |
chore: update ${{ steps.vars.outputs.job_name }} for ${{ steps.vars.outputs.version }}
title: Update ${{ steps.vars.outputs.job_name }} for ${{ steps.vars.outputs.version }}
body: |
This PR updates the demo gif for ${{ steps.vars.outputs.job_name }} with Atmos version ${{ steps.vars.outputs.version }}.
base: main
labels: no-release
- name: Add Image to Job Summary
if: steps.auto-commit.outputs.pull-request-operation == 'created' || steps.auto-commit.outputs.pull-request-operation == 'updated'
run: |
echo "## Demo GIF" >> $GITHUB_STEP_SUMMARY
echo "![Demo GIF](https://github.com/${{ github.repository }}/blob/${{ steps.auto-commit.outputs.pull-request-head-sha }}/docs/demo.gif?raw=true)" >> $GITHUB_STEP_SUMMARY
echo "## Demo Video" >> $GITHUB_STEP_SUMMARY
echo "https://github.com/${{ github.repository }}/blob/${{ steps.auto-commit.outputs.pull-request-head-sha }}/demo/recordings/mp4/atmos-with-audio.mp4?raw=true" >> $GITHUB_STEP_SUMMARY
- name: No changes
if: steps.auto-commit.outputs.pull-request-operation == 'none' || steps.auto-commit.outputs.pull-request-operation == 'closed'
run: |
echo "No changes to demo" >> $GITHUB_STEP_SUMMARY