forked from spack/spack-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (57 loc) · 1.98 KB
/
update-src-mirror.yml
File metadata and controls
67 lines (57 loc) · 1.98 KB
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
name: update-src-mirror
on:
push:
branches:
- develop
permissions:
id-token: write # Required for AWS OIDC authentication
contents: read
jobs:
update-mirror:
if: github.repository == 'spack/spack-packages'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Depth 2 is required for this check
fetch-depth: 2
- name: Checkout Spack
uses: ./.github/actions/checkout-spack
with:
fetch-depth: 1
- name: Create source mirror
id: create-mirror
run: |
source spack-core/share/spack/setup-env.sh
# Create source mirror for changed specs
SPECS=$(spack repo show-version-updates \
--no-manual-packages \
--only-redistributable \
--no-git-versions \
builtin \
"${{ github.event.before }}" \
"${{ github.event.after }}")
if [ -z "$SPECS" ]; then
echo "No specs to mirror"
echo "new-specs=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "Creating mirror for:"
echo "$SPECS"
spack -c concretizer:unify:false mirror create -d src-mirror $SPECS
echo "new-specs=true" >> $GITHUB_OUTPUT
- name: Configure AWS credentials
if: steps.create-mirror.outputs.new-specs == 'true'
uses: aws-actions/configure-aws-credentials@d979d5b3a71173a29b74b5b88418bfda9437d885 # v6.1.1
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Upload to S3
if: steps.create-mirror.outputs.new-specs == 'true'
run: |
aws s3 cp src-mirror/_source-cache s3://${{ secrets.S3_BUCKET_NAME }}/_source-cache/ \
--no-overwrite \
--recursive \
--no-progress
echo "Successfully uploaded source mirror to S3"