on:
  push:
    tags:
      - 'releases/**'

name: Create release with asset

jobs:
  build:
    name: Create release with asset
    runs-on:  ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@master
      - name: Get release version
        run: |
          echo "::set-env name=release_version::$(basename ${{ github.ref }})"
      - name: Build package
        run: |
          ./.github/workflows/build.sh ${{ env.release_version }}
      - name: Get commit message
        run: |
          echo "::set-env name=commit_message::$(git log --format=%B -n 1 ${{ github.sha }})"
      - name: Create release
        id: create_release
        uses: actions/create-release@latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Hailstorm ${{ github.ref }}
          body: ${{ env.commit_message }}
      - name: Upload release asset
        id: upload-releast-asset
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./hailstorm-${{ env.release_version }}.tar.gz
          asset_name: hailstorm-${{ env.release_version }}.tar.gz
          asset_content_type: application/gzip

on:
  push:
    tags:
      - 'releases/**'

name: Create release with asset

jobs:
  build:
    name: Create release with asset
    runs-on:  ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@master
      - name: Get release version
        run: |
          echo "release_version=$(basename ${{ github.ref }})" >> $GITHUB_ENV
      - name: Build package
        run: |
          ./.github/workflows/build.sh ${{ env.release_version }}
      - name: Get commit message
        run: |
          echo "commit_message=$(git log --format=%B -n 1 ${{ github.sha }})" >> $GITHUB_ENV
      - name: Create release
        id: create_release
        uses: actions/create-release@latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Hailstorm ${{ github.ref }}
          body: ${{ env.commit_message }}
      - name: Upload release asset
        id: upload-releast-asset
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./hailstorm-${{ env.release_version }}.tar.gz
          asset_name: hailstorm-${{ env.release_version }}.tar.gz
          asset_content_type: application/gzip

Set env var without ::set-env
Set env var without ::set-env
