Skip to content

Commit

Permalink
Create release and upload artifacts after build
Browse files Browse the repository at this point in the history
  • Loading branch information
alexroan committed May 31, 2024
1 parent 363f198 commit b8fdd76
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,30 +86,41 @@ jobs:

# Export BIN_RELEASE to GITHUB_ENV
echo "BIN_RELEASE_VERSIONED=${BIN_RELEASE_VERSIONED}" >> $GITHUB_ENV

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.BIN_COMMIT }}-${{ matrix.name }}
release_name: Release ${{ env.BIN_COMMIT }}-${{ matrix.name }}
draft: true
prerelease: true

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.BIN_RELEASE_VERSIONED }}
path: ${{ env.BIN_RELEASE_VERSIONED }}

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
create_release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.BIN_RELEASE_VERSIONED }}
asset_name: ${{ env.BIN_RELEASE_VERSIONED }}
asset_content_type: application/octet-stream
tag_name: "release-${{ github.run_id }}"
release_name: "Release ${{ github.run_id }}"
draft: false
prerelease: false

- name: Download All Artifacts
uses: actions/download-artifact@v2

- name: Upload All Release Assets
run: |
for file in *; do
if [ -f "$file" ]; then
echo "Uploading $file"
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"$file" \
"${{ steps.create_release.outputs.upload_url }}?name=$(basename $file)"
fi
done
shell: bash

0 comments on commit b8fdd76

Please sign in to comment.