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