Skip to content

Commit

Permalink
5.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-yurchenko committed Apr 9, 2023
1 parent dad7776 commit 719adb5
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 60 deletions.
26 changes: 19 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [5.0.2] - 2023-04-09

### Fixed

- [Issue #90](https://github.com/anton-yurchenko/git-release/issues/90) Awkward behavior in UNRELEASED flow when tag is present without release itself (*Thanks to [Benjamin K.](https://github.com/treee111)*)

### Changed

- Update dependencies
- Update Golang version

## [5.0.1] - 2022-12-14

### Fixed
Expand Down Expand Up @@ -303,7 +314,7 @@ This is a major release as most of the code was refactored and some behavior was
### Changed

- **local** package renamed to **repository**
- **remote** package splitted into 2 packages: **asset**, **release**
- **remote** package split into 2 packages: **asset**, **release**
- Tag version is set as a release title

## [1.1.0] - 2019-12-21
Expand All @@ -325,7 +336,7 @@ This is a major release as most of the code was refactored and some behavior was
### Fixed

- Wrong PRE_RELEASE message when set
- Correct 'creating release' log message
- Correct `creating release` log message

## [0.2.0] - 2019-10-01

Expand All @@ -336,7 +347,7 @@ This is a major release as most of the code was refactored and some behavior was

### Changed

- Remove 'v' from release name
- Remove `v` from release name

### Fixed

Expand All @@ -351,18 +362,19 @@ This is a major release as most of the code was refactored and some behavior was

### Removed

- 'DRAFT_RELEASE=false' warning logging
- 'PRE_RELEASE=false' warning logging
- `DRAFT_RELEASE=false` warning logging
- `PRE_RELEASE=false` warning logging

## [0.1.0] - 2019-09-29

### Added

- Create GitHub Release
- Upload Assets
- Control Release Draft through env.var 'DRAFT_RELEASE'
- Control Release Pre Release through env.var 'PRE_RELEASE'
- Control Release Draft through env.var `DRAFT_RELEASE`
- Control Release Pre Release through env.var `PRE_RELEASE`

[5.0.2]: https://github.com/anton-yurchenko/git-release/compare/v5.0.1...v5.0.2
[5.0.1]: https://github.com/anton-yurchenko/git-release/compare/v5.0.0...v5.0.1
[5.0.0]: https://github.com/anton-yurchenko/git-release/compare/v4.2.4...v5.0.0
[4.2.4]: https://github.com/anton-yurchenko/git-release/compare/v4.2.3...v4.2.4
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19 as builder
FROM golang:1.20 as builder
WORKDIR /opt/src
COPY . .
RUN groupadd -g 1000 appuser &&\
Expand All @@ -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="v5.0.1"
LABEL org.opencontainers.image.version="v5.0.2"
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.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module git-release

go 1.19
go 1.20

require (
github.com/anton-yurchenko/go-changelog v1.0.4
github.com/google/go-github v17.0.0+incompatible
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.0
github.com/spf13/afero v1.9.3
github.com/stretchr/testify v1.8.1
github.com/spf13/afero v1.9.5
github.com/stretchr/testify v1.8.2
golang.org/x/oauth2 v0.7.0
)

Expand Down
14 changes: 9 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=
github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
Expand All @@ -156,8 +156,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand All @@ -174,7 +174,7 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -241,6 +241,7 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -296,6 +297,7 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand All @@ -308,6 +310,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
13 changes: 3 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"strings"

"git-release/release"

"github.com/pkg/errors"
Expand All @@ -14,7 +12,7 @@ import (
)

// Version contains current application version
const Version string = "5.0.1"
const Version string = "5.0.2"

func init() {
log.SetReportCaller(false)
Expand Down Expand Up @@ -80,15 +78,10 @@ func main() {
}

if conf.UnreleasedCreate || conf.UnreleasedDelete {
log.Warnf("deleting precedent release ❗")
err := rel.DeleteUnreleased(cli.Repositories, cli.Git)
if err != nil {
if !strings.Contains(err.Error(), "precedent release not found") {
log.Fatal(errors.Wrap(err, "error preparing for Unreleased release update"))
}

log.Warn(err.Error())
} else {
log.Warnf("precedent release deleted ❗")
log.Fatal(errors.Wrap(err, "error preparing for Unreleased release update"))
}

if conf.UnreleasedDelete {
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": "5.0.1",
"version": "5.0.2",
"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
64 changes: 33 additions & 31 deletions release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,21 @@ func (r *Release) DeleteUnreleased(repoCli RepositoriesClient, gitCli GitClient)
r.Slug.Name,
r.Reference.Tag,
)
if err != nil {
if !strings.Contains(err.Error(), "404 Not Found") {
return errors.Wrapf(err, "error retrieving a precedent release with a tag %v", r.Reference.Tag)
}

return errors.New("precedent release not found")
}

_, err = repoCli.DeleteRelease(
context.Background(),
r.Slug.Owner,
r.Slug.Name,
previous.GetID(),
)
if err != nil {
return errors.Wrap(err, "error deleting precedent release")
if err == nil {
_, err = repoCli.DeleteRelease(
context.Background(),
r.Slug.Owner,
r.Slug.Name,
previous.GetID(),
)
if err != nil {
return errors.Wrap(err, "error deleting precedent release")
}
} else if !strings.Contains(err.Error(), "404 Not Found") {
return errors.Wrapf(err, "error retrieving a precedent release with a tag %v", r.Reference.Tag)
} else {
log.Warn("precedent release not found")
}

_, err = gitCli.DeleteRef(
Expand All @@ -221,26 +220,29 @@ func (r *Release) DeleteUnreleased(repoCli RepositoriesClient, gitCli GitClient)
r.Slug.Name,
tag,
)
if err != nil {
return errors.Wrap(err, "error deleting precedent tag")
}
if err == nil {
// tag deletion takes some time to be reflected
for i := 0; i < 3; i++ {
_, _, err := gitCli.GetRef(
context.Background(),
r.Slug.Owner,
r.Slug.Name,
tag,
)
if err != nil {
if strings.Contains(err.Error(), "404 Not Found") {
break
}

for i := 0; i < 3; i++ {
_, _, err := gitCli.GetRef(
context.Background(),
r.Slug.Owner,
r.Slug.Name,
tag,
)
if err != nil {
if strings.Contains(err.Error(), "404 Not Found") {
break
return errors.Wrap(err, "error fetching precedent tag")
}

return errors.Wrap(err, "error fetching precedent tag")
time.Sleep(3 * time.Second)
}

time.Sleep(3 * time.Second)
} else if !strings.Contains(err.Error(), "422 Reference does not exist") {
return errors.Wrap(err, "error deleting precedent tag")
} else {
log.Warn("precedent tag not found")
}

return nil
Expand Down

0 comments on commit 719adb5

Please sign in to comment.