@@ -58,12 +58,13 @@ jobs:
5858 fi
5959
6060 - name : Upload artifact
61- uses : actions/upload-artifact@v3
61+ uses : actions/upload-artifact@v4
6262 with :
6363 name : ${{ matrix.asset_name }}
6464 path : dist/${{ matrix.asset_name }}
6565 retention-days : 1
6666 if-no-files-found : error
67+ compression-level : 0
6768
6869 release :
6970 needs : build
7273 steps :
7374 - name : Checkout code
7475 uses : actions/checkout@v3
76+
77+ - name : Install dependencies
78+ run : |
79+ sudo apt-get update
80+ sudo apt-get install -y jq
7581
7682 - name : Download artifacts
77- uses : actions/download-artifact@v3
83+ uses : actions/download-artifact@v4
7884 with :
7985 path : dist
8086
@@ -103,11 +109,39 @@ jobs:
103109
104110 - name : Create release
105111 id : create_release
106- uses : softprops/action-gh-release@v1
107- with :
108- files : release_files/*
109- draft : false
110- prerelease : false
111- generate_release_notes : true
112112 env :
113- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
113+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
114+ run : |
115+ # Extract version from tag
116+ VERSION=${GITHUB_REF#refs/tags/}
117+ echo "Creating release for $VERSION"
118+
119+ # Create the release
120+ RELEASE_RESPONSE=$(curl -s -X POST \
121+ -H "Authorization: token $GITHUB_TOKEN" \
122+ -H "Accept: application/vnd.github.v3+json" \
123+ https://api.github.com/repos/${{ github.repository }}/releases \
124+ -d '{
125+ "tag_name": "'$VERSION'",
126+ "name": "AIScript '$VERSION'",
127+ "body": "Release of AIScript '$VERSION'",
128+ "draft": false,
129+ "prerelease": false,
130+ "generate_release_notes": true
131+ }')
132+
133+ RELEASE_ID=$(echo $RELEASE_RESPONSE | jq -r .id)
134+ echo "Created release with ID: $RELEASE_ID"
135+ echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
136+
137+ # Upload assets
138+ for ASSET in release_files/*; do
139+ ASSET_NAME=$(basename $ASSET)
140+ echo "Uploading $ASSET_NAME..."
141+ curl -s -X POST \
142+ -H "Authorization: token $GITHUB_TOKEN" \
143+ -H "Accept: application/vnd.github.v3+json" \
144+ -H "Content-Type: application/octet-stream" \
145+ --data-binary @$ASSET \
146+ "https://uploads.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID/assets?name=$ASSET_NAME"
147+ done
0 commit comments