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 +