Skip to content

Commit

Permalink
Merge pull request #8 from anton-yurchenko/dev
Browse files Browse the repository at this point in the history
v3.0.0
  • Loading branch information
anton-yurchenko authored Jan 5, 2020
2 parents 10cebad + 9e32802 commit e37071d
Show file tree
Hide file tree
Showing 22 changed files with 292 additions and 99 deletions.
6 changes: 1 addition & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@
- Search for already opened [issues](https://github.com/anton-yurchenko/git-release/issues) before submitting a [new one](https://github.com/anton-yurchenko/git-release/issues/new/choose).
- Provide as much information as you can, even if not requested by an Issue Template.


## Pull Request:
- Open [Pull Request](https://github.com/anton-yurchenko/git-release/pulls) towards **dev** branch.
- Ensure [Pull Request](https://github.com/anton-yurchenko/git-release/pulls) description clearly describes the problem and solution.
- Make sure all Tests are passed and there is no Code Coverage degradation.
- Please follow [AngularJS Commit Message Guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines)

## Other:
#### Require new feature or change of an existing one?
- Suggest your change via [email](email:[email protected]) or [Pull Request](https://github.com/anton-yurchenko/git-release/pulls), do not open an issue on GitHub.

#### Have questions about the source code?
- Feel free to contact me via [email](email:[email protected]), I'll be glad to provide any information required.
- Feel free to contact me via [email](mailto:[email protected]), I'll be glad to provide any information required.
23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/report_a_bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Report a Bug
about: Create a report to help us improve
title: ''
labels: ''
assignees: anton-yurchenko

---

### Description:
A clear and concise description of what the bug is

### Workflow:
```Attach your GitHub Action Workflow YAML```

### Changelog:
```Attach a full changelog```

### Log:
```Attach an execution log```

### Screenshots:
If applicable, add screenshots to help explain your problem.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/suggest_a_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Suggest a Change
about: Suggest an enhancement to help us improve
title: ''
labels: ''
assignees: anton-yurchenko

---

### Description:
A clear and concise description of what an enhancement is about

### Reference:
- External documentation links

### Screenshots:
If applicable, add screenshots to help explain your problem.
4 changes: 2 additions & 2 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 14
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- keep
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,12 @@ jobs:
- name: Test
run: go test $(go list ./... | grep -v vendor | grep -v mocks) -race -coverprofile=coverage.txt -covermode=atomic

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: unittests
name: pull-request
fail_ci_if_error: true
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
## [Unreleased]
## [3.0.0] - 2020-01-05
This is a major release because of a certain behavior change:
- *Tag (without prefix) should be identical to Changelog Version in order for changes to be mapped (for example tag `v3.0.0-rc.1` is expected to be listed as `3.0.0-rc.1` in changelog).*
- *By default valid semver version is expected. Prefix should be explicitly allowed by enabling `ALLOW_TAG_PREFIX`*

### Changed
- Replace CircleCI with GitHub Actions as a Continuous Integration system
- Better `GITHUB_REPOSITORY` regex validation
- Improved **Changelog** package parsing capabilities
- Tag should match Changelog Version (excluding prefix)

### Fixed
- Semantic Versioning compliance
- Keep a Changelog compliance

### Added
- `ALLOW_TAG_PREFIX` to control version prefix like `v` or `release`

## [2.0.2] - 2019-12-29
### Added
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o /opt/app
FROM scratch
LABEL "repository"="https://github.com/anton-yurchenko/git-release"
LABEL "maintainer"="Anton Yurchenko <[email protected]>"
LABEL "version"="2.0.2"
LABEL "version"="3.0.0"
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /etc/passwd /etc/passwd
COPY LICENSE.md /LICENSE.md
Expand Down
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/antonyurchenko/git-release)](https://hub.docker.com/r/antonyurchenko/git-release)
[![License](https://img.shields.io/github/license/anton-yurchenko/git-release)](LICENSE.md)

A GitHub Action for creating a GitHub Release with Assets and Changelog whenever a new Tag is pushed to the repository.
A **GitHub Action** for creating a **GitHub Release** with **Assets** and **Changelog** whenever a new **Tag** is pushed to the repository.

![PIC](docs/images/release.png)

Expand All @@ -19,7 +19,7 @@ A GitHub Action for creating a GitHub Release with Assets and Changelog whenever
## Manual:
1. Add your changes to `CHANGELOG.md` in the following format (according to [keepachangelog.com](https://keepachangelog.com/en/1.0.0/ "Keep a ChangeLog")):
```
## [2.0.0] - 2019-12-21
## [3.0.0-rc.1] - 2019-12-21
### Added
- Feature A
- Feature B
Expand All @@ -34,14 +34,13 @@ A GitHub Action for creating a GitHub Release with Assets and Changelog whenever
- Previous Artifactory
```
2. Tag a commit with Version (according to [semver.org](https://semver.org/ "Semantic Versioning")).
- Prefix supported (for example `v2.0.1` or `release-1.2.0`).
- Postfix currently **not supported** (for example `1.2.0-rc1`)
- Prefix support is available (for example `v3.0.0`), see configuration section in order to enable it.
3. Push and watch **Git-Release** publishing a Release on GitHub ;-)
![PIC](docs/images/log.png)

## Configuration:
1. Change the workflow to be triggered on Tag Push:
- Use either `'*'` or a more specific like `'v*'`:
- For example `'*'` or a more specific like `'v*'`:
```
on:
push:
Expand All @@ -51,10 +50,11 @@ on:
2. Add Release stage to your workflow:
- Customize configuration with **env.vars**:
- Provide a list of assets as `args` (divided by one of: `new line`, `space`, `comma`, `pipe`)
- `DRAFT_RELEASE: "true"` - Save release as draft instead of publishing it (default `false`).
- `PRE_RELEASE: "true"` - GitHub will point out that this release is identified as non-production ready (default `false`).
- `CHANGELOG_FILE: "changes.md"` - Changelog filename (default `CHANGELOG.md`).
- `ALLOW_EMPTY_CHANGELOG: "true"` - Allow publishing a release without changelog (default `false`).
- `DRAFT_RELEASE: [true, false]` - Save release as draft instead of publishing it (default `false`).
- `PRE_RELEASE: [true, false]` - GitHub will point out that this release is identified as non-production ready (default: `false`).
- `CHANGELOG_FILE: string` - Changelog filename (default: `CHANGELOG.md`).
- `ALLOW_EMPTY_CHANGELOG: [true, false]` - Allow publishing a release without changelog (default `false`).
- `ALLOW_TAG_PREFIX: [true, false]` - Allow prefix on version Tag, for example `v3.0.0` or `release-3.0.0` (default: `false`).
```
- name: Release
uses: docker://antonyurchenko/git-release:latest
Expand All @@ -63,15 +63,19 @@ on:
DRAFT_RELEASE: "false"
PRE_RELEASE: "false"
CHANGELOG_FILE: "CHANGELOG.md"
ALLOW_EMPTY_CHANGELOG: "true"
ALLOW_TAG_PREFIX: "true"
with:
args: |
build/release/darwin-amd64.zip
build/release/linux-amd64.zip
build/release/windows-amd64.zip
build/darwin-amd64.zip
build/linux-amd64.zip
build/windows-amd64.zip
```

## Remarks:
- This action is automatically built at Docker Hub, and tagged with `latest / v2 / v2.0 / v2.0.2`. You may lock to a certain version instead of using **latest**. (*Recommended to lock against a major version, for example* `v2`).
- **Git Tag** should be identical to **Changelog Version** in order for changes to be parsed properly. This does not include **Tag Prefix** like `release-*`.
- This action is automatically built at **Docker Hub**, and tagged with `latest / v3 / v3.0 / v3.0.0`. You may lock to a certain version instead of using **latest**.
(*Recommended to lock against a major version, for example* `v3`)
- Instead of using pre-built image, you may build it during the execution of your flow by changing `docker://antonyurchenko/git-release:latest` to `anton-yurchenko/git-release@master`

## License
Expand Down
Binary file modified docs/images/log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/release.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 11 additions & 4 deletions internal/app/exported.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
// Configuration is a git-release settings struct
type Configuration struct {
AllowEmptyChangelog bool
AllowTagPrefix bool
}

// GetConfig sets validated Release/Changelog configuration and returns github.com Token
Expand Down Expand Up @@ -50,12 +51,18 @@ func GetConfig(release release.Interface, changes changelog.Interface, fs afero.
log.Fatal("env.var 'GITHUB_WORKSPACE' not defined")
}

temp := os.Getenv("ALLOW_EMPTY_CHANGELOG")
if strings.ToLower(temp) == "true" {
t := os.Getenv("ALLOW_EMPTY_CHANGELOG")
if strings.ToLower(t) == "true" {
log.Warn("'ALLOW_EMPTY_CHANGELOG' enabled")
conf.AllowEmptyChangelog = true
}

t = os.Getenv("ALLOW_TAG_PREFIX")
if strings.ToLower(t) == "true" {
log.Warn("'ALLOW_TAG_PREFIX' enabled")
conf.AllowTagPrefix = true
}

c := os.Getenv("CHANGELOG_FILE")
if c == "" {
log.Warn("env.var 'CHANGELOG_FILE' not defined, assuming 'CHANGELOG.md'")
Expand Down Expand Up @@ -88,7 +95,7 @@ func Login(token string) *github.Client {
}

// Hydrate fetches project's git repository information
func Hydrate(local repository.Interface, version *string) error {
func (c *Configuration) Hydrate(local repository.Interface, version *string) error {
if err := local.ReadProjectName(); err != nil {
return err
}
Expand All @@ -97,7 +104,7 @@ func Hydrate(local repository.Interface, version *string) error {
return err
}

if err := local.ReadTag(version); err != nil {
if err := local.ReadTag(version, c.AllowTagPrefix); err != nil {
return err
}

Expand Down
Loading

0 comments on commit e37071d

Please sign in to comment.