Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

releasing on git tag #16

Closed
stevenaldinger opened this issue Sep 3, 2020 · 5 comments
Closed

releasing on git tag #16

stevenaldinger opened this issue Sep 3, 2020 · 5 comments

Comments

@stevenaldinger
Copy link

Is there a way to pass in the release name? I don't want to have to manually create releases, I want to be able to push to a git tag, automatically create a release, and then upload binaries to it.

I tried using two separate actions, one that creates a release and then a separate one that is triggered on release. The second action was never actually triggered but I'd rather not work around the core issue anyway, I want it to be in one job.

the following action gets the curl: (6) Could not resolve host: null error.

name: Build and Release Binaries

on:
  push:
    tags:
    # Push events to matching v*, i.e. v1.0, v20.15.10
    - 'v*'

jobs:
 create-release:
    runs-on: ubuntu-latest
    steps:
    - name: Create Release
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: ${{ github.ref }}
        body: |
          Release ${{ github.ref }}
        draft: false
        prerelease: false

  build-and-release-github:
    needs: [create-release]
    name: Release Go Binary
    runs-on: ubuntu-latest
    strategy:
      matrix:
        goos: [linux, windows, darwin]
        goarch: [amd64]
    steps:
    - uses: actions/checkout@v2
    - name: Go Release Binaries
      uses: wangyoucao577/go-release-action@v1.6
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        goos: ${{ matrix.goos }}
        goarch: ${{ matrix.goarch }}
        goversion: "https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz"
        project_path: "./client"
        binary_name: "client"
        build_flags: -v
@wangyoucao577
Copy link
Owner

wangyoucao577 commented Sep 3, 2020

It's not a good idea to create a new release via push tag event, because a new tag will always be created via create a new release.
Based on your requirement, a resonable workaround maybe create two workflows:

  1. create release, trigger by push branch(e.g., create a new release/v1.2.0 branch);
  2. release binaries, trigger by release [create]. (This is what the current go-release-action do)

Does it sound good to you?

On the other hand, it might be valuable to add another parameter upload_url in this go-release-action so that you can combine them together into one workflow. I may add it later.

@wangyoucao577
Copy link
Owner

@stevenaldinger Have you tried the above approach? Does it work for you?

@btisdall
Copy link

btisdall commented Oct 4, 2020

Hi @wangyoucao577 I tried this approach with no success. Publishing the assets works when I create the release manually but not when the release is created by the Create Release action.

@btisdall
Copy link

btisdall commented Oct 4, 2020

Ok, the problem was simply the one outlined here, with a custom access token for the Create Release action everything works. Not clear to me precisely which permissions the token needs but full repo scope and nothing else works. Thanks for the useful action!

@wangyoucao577
Copy link
Owner

Now you have another choice:

  • Switch to version wangyoucao577/go-release-action@v1.10
  • Specify pre-created release by release_tag(note that it's Git tag of the release)
  • Allow overwrite by set overwrite: true
  • Trigger the action by push, then you'll get new assets published to your release page per push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants