JasonEtco/upload-to-release

Getting the tag name of release

Opened this issue · 2 comments

I have this workflow:

name: Publish the Debian Package

on:
  release:
    types: [published]

jobs:
  publish-deb-package:
    name: Build and publish the Debian package
    runs-on: ubuntu-latest
    container:
      image: docker://dragoncomputer/dragonfire:latest

    steps:
      - uses: actions/checkout@v1

      - name: Cache pip packages
        uses: actions/cache@v1
        with:
          path: /root/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      - name: Install dependencies
        run: |
          pip3 install -e .

      - name: Generate the Debian package
        run: |
          dpkg-buildpackage -us -uc
          cd ..
          echo ${{ github.ref }} | cut -c12- | { read version; }

      - name: Upload to release
        uses: JasonEtco/upload-to-release@master
        with:
          args: dragonfire_${version}_amd64.deb
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

With echo ${{ github.ref }} | cut -c12- | { read version; } I aim to get 1.0.7 from refs/tags/v1.0.7(which is the output of the value of github.ref) but passing to args: seems impossible. dragonfire_${version}_amd64.deb resolves into dragonfire_${version}_amd64.deb while either dragonfire_1.0.7_amd64.deb or dragonfire__amd64.deb expected.

How can I achieve what I'm trying to achieve here?

Try using ${{ github.event.release.tag_name }}

I use that for my workflow without issues.

@Andre601 but tag name has v like v1.0.1 and the version's itself has not 1.0.1. I achieved that with this.