Skip to content

Commit

Permalink
4.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-yurchenko committed Feb 21, 2022
1 parent d95e9c1 commit ae5126b
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 31 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [4.2.4] - 2022-02-20

### Fixed

- [Issue #64](https://github.com/anton-yurchenko/git-release/issues/64) Panic on missing API response (*Thanks to [rgriebl](https://github.com/rgriebl)*)

## [4.2.3] - 2022-02-20

### Changed
Expand Down Expand Up @@ -338,6 +344,7 @@ This is a major release as most of the code was refactored and some behavior was
- Control Release Draft through env.var 'DRAFT_RELEASE'
- Control Release Pre Release through env.var 'PRE_RELEASE'

[4.2.4]: https://github.com/anton-yurchenko/git-release/compare/v4.2.3...v4.2.4
[4.2.3]: https://github.com/anton-yurchenko/git-release/compare/v4.2.2...v4.2.3
[4.2.2]: https://github.com/anton-yurchenko/git-release/compare/v4.2.1...v4.2.2
[4.2.1]: https://github.com/anton-yurchenko/git-release/compare/v4.2.0...v4.2.1
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o /opt/app

FROM scratch
LABEL org.opencontainers.image.source="https://github.com/anton-yurchenko/git-release"
LABEL org.opencontainers.image.version="v4.2.3"
LABEL org.opencontainers.image.version="v4.2.4"
LABEL org.opencontainers.image.authors="Anton Yurchenko <[email protected]>"
LABEL org.opencontainers.image.licenses="MIT"
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
Expand Down
Binary file modified bin/git-release-linux-amd64
Binary file not shown.
Binary file modified bin/git-release-windows-amd64.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// Version contains current application version
const Version string = "4.2.3"
const Version string = "4.2.4"

func init() {
log.SetReportCaller(false)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "git-release",
"version": "4.2.3",
"version": "4.2.4",
"description": "A GitHub Action for creating a GitHub Release with Assets and Changelog whenever a new Tag is pushed to the repository.",
"main": "wrapper.js",
"directories": {
Expand Down
52 changes: 25 additions & 27 deletions release/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,38 +113,36 @@ func (a *Asset) uploadHandler(release *Release, cli RepositoriesClient, id int64
if err != nil {
log.WithField("asset", a.Name).Warnf("error uploading asset: %v", err.Error())

if !lastTry && res.Response != nil {
if res.StatusCode == http.StatusBadGateway || res.StatusCode == http.StatusUnprocessableEntity {
rel, _, err := cli.GetReleaseByTag(
context.Background(),
release.Slug.Owner,
release.Slug.Name,
release.Reference.Tag,
)
if err != nil {
return errors.Wrap(err, "error retrieving release")
}
if !lastTry &&
res != nil && res.Response != nil &&
(res.StatusCode == http.StatusBadGateway || res.StatusCode == http.StatusUnprocessableEntity) {
rel, _, err := cli.GetReleaseByTag(
context.Background(),
release.Slug.Owner,
release.Slug.Name,
release.Reference.Tag,
)
if err != nil {
return errors.Wrap(err, "error retrieving release")
}

for _, s := range rel.Assets {
if *s.Name == strings.ReplaceAll(a.Name, "/", "-") {
_, err = cli.DeleteReleaseAsset(
context.Background(),
release.Slug.Owner,
release.Slug.Name,
*s.ID,
)
if err != nil {
return errors.Wrap(err, "error deleting ghost release asset")
}

return errors.New("ghost release asset deleted")
for _, s := range rel.Assets {
if *s.Name == strings.ReplaceAll(a.Name, "/", "-") {
_, err = cli.DeleteReleaseAsset(
context.Background(),
release.Slug.Owner,
release.Slug.Name,
*s.ID,
)
if err != nil {
return errors.Wrap(err, "error deleting ghost release asset")
}
}

return errors.New("ghost release asset not found")
return errors.New("ghost release asset deleted")
}
}

log.WithField("asset", a.Name).Debugf("received unexpected http response code during asset upload: %v", res.StatusCode)
return errors.New("ghost release asset not found")
}

return err
Expand Down

0 comments on commit ae5126b

Please sign in to comment.