-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (61 loc) · 2.78 KB
/
release.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
name: Release
on:
workflow_dispatch:
push:
branches:
- main
permissions:
id-token: write
contents: read
jobs:
test:
runs-on: ubuntu-latest
name: Release
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: nationalarchives/pronom-signatures
path: 'signature-files'
- name: Configure AWS credentials for Lambda
uses: aws-actions/[email protected]
with:
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/SandboxGithubActionsDeployPronomWebsite
aws-region: eu-west-2
role-session-name: DeployPRONOM
- run: |
pip install boto3
pip install -r requirements-generate.txt
mkdir -p site/fmt site/x-fmt site/actor site/edit/fmt site/edit/x-fmt site/edit/new/fmt site/edit/new/x-fmt
python .github/scripts/generate_pages.py "$PWD/signature-files"
cd site
aws s3 sync --quiet --content-type text/html . s3://tna-pronom-signatures-spike
cd ..
python .github/scripts/generate_index_file.py "$PWD/signature-files"
mkdir -p package
pip install -r requirements-results.txt --target=package
cd package
zip -r ../function.zip .
cd ..
zip function.zip templates/index.html templates/search_results.html results.py indexes
aws lambda update-function-code --zip-file fileb://function.zip --function-name pronom-results
LATEST_SIGNATURE_FILE=$(aws s3 ls s3://tna-pronom-signatures-spike/signatures/ | sort -t'V' -k2,2n | tail -1 | awk '{split($0,a," "); print a[4]}')
aws lambda update-function-configuration --function-name pronom-soap --environment Variables={DOWNLOAD_URL=https://d3hk4y84s0zka0.cloudfront.net/signatures/$LATEST_SIGNATURE_FILE}
while true; do
status=$(aws lambda get-function --function-name pronom-soap --query 'Configuration.LastUpdateStatus' --output text)
if [ "$status" = "Successful" ]; then
echo "Update status is Successful. Proceeding..."
break
fi
sleep 0.5
done
python .github/scripts/generate_version_file.py $LATEST_SIGNATURE_FILE
zip function-soap.zip soap.py version
aws lambda update-function-code --zip-file fileb://function-soap.zip --function-name pronom-soap
mkdir -p package-submissions
pip install -r requirements-submissions.txt --target=package-submissions
cd package-submissions
zip -r ../submissions.zip .
cd ..
zip submissions.zip submissions.py
aws lambda update-function-code --zip-file fileb://submissions.zip --function-name pronom-submissions