Skip to content

Commit

Permalink
try new release logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Edru2 committed Feb 18, 2024
1 parent 24afb9d commit f3ed72b
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,41 +49,41 @@ jobs:
name: GoLuaWebserver-${{ matrix.goos }}-${{ matrix.goarch }}
path: ./*.${{ matrix.suffix }}

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release-${{ github.run_number }}-${{ github.sha }}
release_name: Release ${{ github.sha }}
draft: false
prerelease: false
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release-${{ github.run_number }}-${{ github.sha }}
release_name: Release ${{ github.sha }}
draft: false
prerelease: false

- name: Upload Release Assets
run: |
ARTIFACTS_DIR=artifacts
if [ -d "$ARTIFACTS_DIR" ] && [ "$(ls -A $ARTIFACTS_DIR)" ]; then
for FILE in $ARTIFACTS_DIR/*; do
FILE_NAME=$(basename "$FILE")
echo "Uploading $FILE_NAME"
MIME_TYPE=$(file -b --mime-type "$FILE")
UPLOAD_URL="${{ steps.create_release.outputs.upload_url }}?name=$FILE_NAME&label=$FILE_NAME"
RESPONSE=$(curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: $MIME_TYPE" --data-binary @"$FILE" "$UPLOAD_URL")
echo "Upload response: $RESPONSE"
done
else
echo "No artifacts found in $ARTIFACTS_DIR."
fi
shell: bash
- name: Upload Release Assets
run: |
ARTIFACTS_DIR=artifacts
if [ -d "$ARTIFACTS_DIR" ] && [ "$(ls -A $ARTIFACTS_DIR)" ]; then
for FILE in $ARTIFACTS_DIR/*; do
FILE_NAME=$(basename "$FILE")
echo "Uploading $FILE_NAME"
MIME_TYPE=$(file -b --mime-type "$FILE")
UPLOAD_URL="${{ steps.create_release.outputs.upload_url }}?name=$FILE_NAME&label=$FILE_NAME"
RESPONSE=$(curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: $MIME_TYPE" --data-binary @"$FILE" "$UPLOAD_URL")
echo "Upload response: $RESPONSE"
done
else
echo "No artifacts found in $ARTIFACTS_DIR."
fi
shell: bash

0 comments on commit f3ed72b

Please sign in to comment.