1+ name : re-upload_release_to_dl_esp
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ release_tag :
7+ type : string
8+ description : ' Release Tag'
9+ required : true
10+ pull_request :
11+ types : [opened, synchronize, reopened]
12+
13+ jobs :
14+ re-upload :
15+ runs-on : ubuntu-latest
16+ # Run on manual trigger or PR events
17+ if : github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
18+ steps :
19+ - name : Checkout repository
20+ uses : actions/checkout@v4
21+
22+ - name : Parse release tag from input or use default
23+ id : get-tag
24+ run : |
25+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
26+ TAG="${{ github.event.inputs.release_tag }}"
27+ else
28+ # For PR triggers, use this tag
29+ TAG="offline-5.4.3"
30+ echo "PR trigger detected, using default tag: $TAG"
31+ fi
32+ echo "release_tag=$TAG" >> $GITHUB_OUTPUT
33+ echo "Using release tag: $TAG"
34+
35+ - name : Download Release Asset
36+ id : download-asset
37+ env :
38+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
39+ RELEASE_NAME : ${{ steps.get-tag.outputs.release_tag }}
40+ run : |
41+ # Get the release by name/tag
42+ echo "Fetching release: $RELEASE_NAME"
43+ gh release download "$RELEASE_NAME" \
44+ --pattern "esp-idf-tools-setup-*.exe" \
45+ --dir ./build/ \
46+ --repo ${{ github.repository }}
47+
48+ # Find the downloaded file and set as output
49+ ASSET_FILE=$(find ./build/ -name "esp-idf-tools-setup-*.exe" -type f | head -n1)
50+ echo "Downloaded asset: $ASSET_FILE"
51+ echo "asset_path=$ASSET_FILE" >> $GITHUB_OUTPUT
52+
53+ # Extract version from filename for later use
54+ FILENAME=$(basename "$ASSET_FILE")
55+ VERSION=$(echo "$FILENAME" | sed -n 's/esp-idf-tools-setup-\(.*\)\.exe/\1/p')
56+ echo "version=$VERSION" >> $GITHUB_OUTPUT
57+ echo "Extracted version: $VERSION"
58+
59+ - name : Upload Release Asset To dl.espressif.com
60+ id : upload-release-asset-espressif
61+ env :
62+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
63+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
64+ AWS_DEFAULT_REGION : ${{ secrets.AWS_DEFAULT_REGION }}
65+ run : |
66+ ASSET_PATH="${{ steps.download-asset.outputs.asset_path }}"
67+ VERSION="${{ steps.download-asset.outputs.version }}"
68+
69+ echo "Uploading $ASSET_PATH to S3..."
70+ aws s3 cp --acl=public-read --no-progress "$ASSET_PATH" \
71+ s3://${{ secrets.DL_BUCKET }}/dl/idf-installer/esp-idf-tools-setup-$VERSION.exe
72+
73+ echo "Upload completed successfully!"
0 commit comments