-
Notifications
You must be signed in to change notification settings - Fork 18
78 lines (69 loc) · 2.63 KB
/
_mirror-distribution.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
name: _get-unmirrored-distributions
env:
CARGO_TERM_COLOR: always
on:
workflow_call:
inputs:
distribution:
type: string
required: true
secrets:
AWS_S3_BUCKET:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
jobs:
get-unmirrored-versions:
name: Get Unmirrored Versions
runs-on: ubuntu-24.04
outputs:
versions: ${{ steps.get-unmirrored-versions.outputs.versions }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Update Rust toolchain
run: rustup update
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Get unmirrored versions
id: get-unmirrored-versions
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: echo "versions=$(cargo run --bin list_unmirrored_versions ${{ inputs.distribution }})" >> $GITHUB_OUTPUT
mirror-distribution:
name: Mirror v${{ matrix.version }} ${{ matrix.platform && format('({0})', matrix.platform) || '' }}
needs: [get-unmirrored-versions]
runs-on: ubuntu-24.04
if: needs.get-unmirrored-versions.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJson(needs.get-unmirrored-versions.outputs.versions) }}
include: ${{ fromJson(inputs.distribution == 'node' && '[{"platform":"linux-x64"}]' || '[]') }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download and verify distribution
run: |
if [ "${{ inputs.distribution }}" = "node" ]; then
common/bin/download-verify-node "${{ matrix.version }}" "${{ matrix.platform }}"
else
common/bin/download-verify-npm-package "${{ inputs.distribution }}" "${{ matrix.version }}"
fi
- name: Upload ${{ matrix.version }} to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
run: |
if [ "${{ inputs.distribution }}" = "node" ]; then
aws s3 cp \
"node-v${{ matrix.version }}-${{ matrix.platform }}.tar.gz" \
"s3://${{ secrets.AWS_S3_BUCKET }}/node/release/${{ matrix.platform}}/node-v${{ matrix.version }}-${{ matrix.platform }}.tar.gz"
else
aws s3 cp \
"${{ inputs.distribution }}-v${{ matrix.version }}.tar.gz" \
"s3://${{ secrets.AWS_S3_BUCKET }}/${{ inputs.distribution }}/release/${{ inputs.distribution }}-v${{ matrix.version }}.tar.gz"
fi