From 357c5c8701193825f75640556c337b78af97297b Mon Sep 17 00:00:00 2001 From: beerpsi <92439990+beerpiss@users.noreply.github.com> Date: Tue, 11 Jan 2022 06:10:37 +0700 Subject: [PATCH] this should work i think --- .github/workflows/build.yaml | 46 ++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b30d604..b849c60 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,8 +1,5 @@ -on: - push: - branches: - - main +on: push jobs: build: @@ -34,3 +31,44 @@ jobs: uses: actions/upload-artifact@v2 with: path: output/* + upload-prerelease: + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' # Only upload prereleases when it gets merged to main + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Download artifacts + uses: actions/download-artifact@v2 + - + name: Get version information + run: | + echo "todayDate=$(date +%Y%m%dT%H%M%SZ)" >> $GITHUB_ENV + - + name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.todayDate }} + release_name: Prerelease ${{ env.todayDate }} + draft: false + prerelease: true + - + name: Attach binaries to release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + todayDate: ${{ env.todayDate }} + version: ${{ env.version }} + name: ${{ env.name }} + run: | + set -x + assets=() + for asset in ./artifact/*; do + assets+=("-a" "$asset") + done + hub release edit "${assets[@]}" -m "Prerelease $todayDate" $todayDate +