Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-yurchenko committed Feb 14, 2021
0 parents commit ba32b99
Show file tree
Hide file tree
Showing 23 changed files with 1,519 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.github/
.circleci/
.vscode/
.idea/
.git/
docs/
examples/
.gitignore
.dockerignore
*.md
!LICENSE.md
coverage.txt
Dockerfile
Makefile
15 changes: 15 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing Guidelines

:confetti_ball::medal_military: First of all, thank you for contributing! :medal_military::confetti_ball:

## Issue:=

- Search for an already opened [issue](https://github.com/ReasonSoftware/action-github-deployment/issues) before submitting a [new one](https://github.com/ReasonSoftware/action-github-deployment/issues/new/choose).
- Provide as much information as you can.

## Pull Request:

- Ensure [Pull Request](https://github.com/ReasonSoftware/action-github-deployment/pulls) description clearly describes the problem and solution.
- Make sure all Tests are passed and there is no Code Coverage degradation.
- Add more tests wherever possible.
- Please follow [AngularJS Commit Message Guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines)
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/report_a_bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
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

### Version

`Provide an Action Version`

### Log

```
Attach an execution log
```

### Configuration

```json
Provide an action configuration
```

### Screenshots

If applicable, add screenshots to help explain your problem.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/suggest_a_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
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

If applicable, add external documentation links.

### Screenshots

If applicable, add screenshots to help explain your problem.
47 changes: 47 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

- [ ] Test A
- [ ] Test B

#### Example Workflow

<details><summary>Clich Here to Expand</summary>

```yaml
name: build
on:
push:
branches:
- master

jobs:
...

</details>

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: monthly
assignees:
- anton-yurchenko
labels:
- dependencies
13 changes: 13 additions & 0 deletions .github/no-reponse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Configuration for probot-no-response - https://github.com/probot/no-response

# Number of days of inactivity before an Issue is closed for lack of response
daysUntilClose: 14
# Label requiring a response
responseRequiredLabel: more-information-needed
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
closeComment: >
This issue has been automatically closed because there has been no response
to our request for more information from the original author. With only the
information that is currently in the issue, we don't have enough information
to take action. Please reach out if you have or find the answers we need so
that we can investigate further.
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: release
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+

jobs:
release:
name: Release
runs-on: ubuntu-latest
env:
APP_NAME: action-github-deployment
steps:
- name: Init
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go

- name: Checkout
uses: actions/checkout@v2

- name: Install Dependencies
run: |
go get -v -t -d ./...
- name: Lint
run: |
export PATH=$PATH:$(go env GOPATH)/bin
curl -s https://api.github.com/repos/golangci/golangci-lint/releases/latest | grep browser_download_url | grep linux-amd64 | cut -d : -f 2,3 | tr -d \" | wget -i -
tar -xvf golangci-lint-*-linux-amd64.tar.gz --strip=1 --no-anchored golangci-lint
./golangci-lint run ./...
- name: Test
run: go test -v $(go list ./... | grep -v vendor | grep -v mocks) -race -coverprofile=coverage.txt -covermode=atomic

- name: Build Application
run: |
GOOS=windows GOARCH=amd64 go build -o ${{ env.APP_NAME }}-windows-amd64.exe
GOOS=linux GOARCH=amd64 go build -o ${{ env.APP_NAME }}-linux-amd64.exe
- name: Prepare Version Tags
run: |
echo "MAJOR=$(echo ${GITHUB_REF/refs\/tags\//} | awk -F'.' '{print $1}')" >> $GITHUB_ENV
echo "MINOR=$(echo ${GITHUB_REF/refs\/tags\//} | awk -F'.' '{print $1"."$2}')" >> $GITHUB_ENV
echo "PATCH=$(echo ${GITHUB_REF/refs\/tags\//} | awk -F'.' '{print $1"."$2"."$3}')" >> $GITHUB_ENV
- name: Build Docker Image
run: |
docker build -t build .
docker tag build docker.pkg.github.com/reasonsoftware/${{ env.APP_NAME }}/${{ env.APP_NAME }}:${{ env.PATCH}}
docker tag build docker.pkg.github.com/reasonsoftware/${{ env.APP_NAME }}/${{ env.APP_NAME }}:${{ env.MINOR}}
docker tag build docker.pkg.github.com/reasonsoftware/${{ env.APP_NAME }}/${{ env.APP_NAME }}:${{ env.MAJOR}}
docker tag build docker.pkg.github.com/reasonsoftware/${{ env.APP_NAME }}/${{ env.APP_NAME }}:latest
docker tag build reasonsoftware/${{ env.APP_NAME }}:${{ env.PATCH}}
docker tag build reasonsoftware/${{ env.APP_NAME }}:${{ env.MINOR}}
docker tag build reasonsoftware/${{ env.APP_NAME }}:${{ env.MAJOR}}
docker tag build reasonsoftware/${{ env.APP_NAME }}:latest
- name: Publish to GitHub
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u reasonsoftware --password-stdin
docker push docker.pkg.github.com/reasonsoftware/${{ env.APP_NAME }}/${{ env.APP_NAME }}:${{ env.PATCH}}
docker push docker.pkg.github.com/reasonsoftware/${{ env.APP_NAME }}/${{ env.APP_NAME }}:${{ env.MINOR}}
docker push docker.pkg.github.com/reasonsoftware/${{ env.APP_NAME }}/${{ env.APP_NAME }}:${{ env.MAJOR}}
docker push docker.pkg.github.com/reasonsoftware/${{ env.APP_NAME }}/${{ env.APP_NAME }}:latest
- name: Publish to Docker
run: |
echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login --username ${{ secrets.DOCKER_HUB_USER }} --password-stdin
docker push reasonsoftware/${{ env.APP_NAME }}:${{ env.PATCH}}
docker push reasonsoftware/${{ env.APP_NAME }}:${{ env.MINOR}}
docker push reasonsoftware/${{ env.APP_NAME }}:${{ env.MAJOR}}
docker push reasonsoftware/${{ env.APP_NAME }}:latest
- name: Release
uses: docker://antonyurchenko/git-release:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ALLOW_TAG_PREFIX: "true"
with:
args: |
${{ env.APP_NAME }}-windows-amd64.exe
${{ env.APP_NAME }}-linux-amd64.exe
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# OS
**/.DS_Store

# IDE
.vscode/
**/__debug_bin
.idea/

# project
coverage.txt
/vendor/
/dist/

cli.json
cli.sh
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## [1.0.0](https://github.com/ReasonSoftware/action-github-deployment/releases/tag/v1.0.0) - 2021-02-14
- First release
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.15 as build
WORKDIR /opt/src
COPY . .
RUN groupadd -g 1000 appuser &&\
useradd -m -u 1000 -g appuser appuser
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o /opt/action-github-deployment

FROM scratch
LABEL "repository"="https://github.com/ReasonSoftware/action-github-deployment"
LABEL "version"="1.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
COPY --from=build --chown=1000:0 /opt/action-github-deployment /app
ENTRYPOINT [ "/app" ]
Loading

0 comments on commit ba32b99

Please sign in to comment.