create-release
create-release copied to clipboard
accidentally create a release for master branch make later push to master fail
Here's the workflows, which should run when tag event happen, but I accidentally comments out those filter, so it create a release tag with name (refs/heads/master) , which cause later push to remote master fail.
I don't found anyway to delete that tag on github, I fixed by delete repository first then recreate again ( which all activities and release are lost, so this sould not happen ).
[wen@234 k8snew actiontest]$ git push origin master
error: dst refspec refs/heads/master matches more than one.
error: failed to push some refs to 'https://github.com/chinglinwen/actiontest.git'
[wen@234 k8snew actiontest]$ git push origin --delete refs/heads/master
error: dst refspec refs/heads/master matches more than one.
error: failed to push some refs to 'https://github.com/chinglinwen/actiontest.git'
[wen@234 k8snew actiontest]$ git tag
2019-10-29
refs/heads/master
v0.0.1
[wen@234 k8snew actiontest]$
on:
push:
# Sequence of patterns matched against refs/tags
# tags:
# - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
name: Upload Release Asset
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: |
go build -v .
echo run actiontest
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
zip --junk-paths actiontest actiontest README.md
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./actiontest.zip
asset_name: actiontest.zip
asset_content_type: application/zip
This is an issue yes.
You can delete the remote tag by git push origin :refs/tags/refs/heads/master.
@k-takata Yes.
While that exists, it's still not appropriate for this action to mess the tags up.
Thanks @k-takata ! I had to delete the tag both remotely and locally:
git push origin :refs/tags/refs/heads/master
git tag -d refs/heads/master
Same issue here.
Ugh, is there no workaround for this? I was trying to migrate a project that only maintains a single release for the master branch. Now, while the build works, you can't push any changes unless you first delete the tag. I can't use the commit SHA for a release name because that gets rejected by the API.
I have seen the same issue when trying to filter by tags + branches. It works fine if i only filter by tags. Is it the case that GitHub's filtering is OR?
name: release
on:
push:
# Sequence of patterns matched against refs/heads
branches:
- master
# Sequence of patterns matched against refs/tags
tags:
- v*
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
# When you use the repository's GITHUB_TOKEN to perform tasks on behalf of the GitHub Actions app, events triggered by the GITHUB_TOKEN will not create a new workflow run.
GITHUB_TOKEN: ${{secrets.PERSONAL_TOKEN}}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
This workflow will create Release refs/heads/master
Same issue here.
git push --follow-tags origin main
name: Create Release
on:
push:
branches:
- main
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # This is important for the Git history
- name: Extract Repo Attributes
id: attrs # This is important for future referencing
uses: ibnesayeed/repo-attrs@master
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
## Changes in this Release
History from `${{ steps.attrs.outputs.tail }}` to `${{ steps.attrs.outputs.head }}`
### Commits
${{ steps.attrs.outputs.commits }}
### Pull Requests
${{ steps.attrs.outputs.prs }}
### Contributors
${{ steps.attrs.outputs.contributors }}
### Files
```
${{ steps.attrs.outputs.files }}
```
draft: false
prerelease: false
rm branches: - main and it work
faced same issue today and this worked for me
I was forced to change the tag name to something static and keep the release name.
I was forced to change the tag name to something static and keep the release name.
Though this works only once and so is not recommended as its a temporary solution
incredible