Skip to content

Commit

Permalink
feat: updated project build process to fetch recent standards
Browse files Browse the repository at this point in the history
  • Loading branch information
mzajkowski committed Mar 18, 2021
1 parent 37a6d2b commit 82f8644
Show file tree
Hide file tree
Showing 15 changed files with 653 additions and 7 deletions.
64 changes: 64 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Version: 1.6.2 (Using https://semver.org/)
# Updated: 2020-11-02
# See https://github.com/RehanSaeed/EditorConfig/releases for release notes.
# See https://github.com/RehanSaeed/EditorConfig for updates to this file.
# See http://EditorConfig.org for more information about .editorconfig files.

##########################################
# Common Settings
##########################################

# This file is the top-most EditorConfig file
root = true

# All Files
[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

##########################################
# File Extension Settings
##########################################

# Visual Studio Solution Files
[*.sln]
indent_style = tab

# Visual Studio XML Project Files
[*.{csproj,vbproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# XML Configuration Files
[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}]
indent_size = 2

# JSON Files
[*.{json,json5,webmanifest}]
indent_size = 2

# YAML Files
[*.{yml,yaml}]
indent_size = 2

# Markdown Files
[*.md]
trim_trailing_whitespace = false

# Web Files
[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,svg,vue}]
indent_size = 2

# Batch Files
[*.{cmd,bat}]
end_of_line = crlf

# Bash Files
[*.sh]
end_of_line = lf

# Makefiles
[Makefile]
indent_style = tab
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Thank you for your pull request, #h5yr! But it's just a beginning.
Please provide details where it's required and review the requirements below.
-->
**What this PR does / why it's submitted / why we need it**:


---

**Checklist**:
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [ ] My PR has a descriptive title (not a vague title like `Needed this`)
- [ ] Title and all the commits follow [commitlint guidelines](https://github.com/conventional-changelog/commitlint#what-is-commitlint)
- [ ] My PR targets the `develop` branch or appropriate `release` branch
- [ ] I've placed the link to the corresponding Trello card or issue which this PR fixes/address below ⤵️

---

Fixes: ### ISSUE_OR_TRELLO_LINK ###
95 changes: 95 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build

on:
pull_request:
branches: [ main, master, develop ]
workflow_run:
workflows: [ "Changelog generator" ]
types:
- completed
workflow_dispatch:

jobs:
build:
name: Build
runs-on: windows-latest
env:
# Dotnet Setup
DOTNET_VERSION: 3.1.401

# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true

# Solution Setup
CONFIG: 'Release'
SOLUTION: 'src\Cogworks.ContentGuard.sln'
PROJECT_NAME: 'Cogworks.ContentGuard'
VERSION: '1.1.0'

# Nuget Setup
NUGET_VERSION: 'latest'
NUGET_OUTPUT: '.output/'

steps:
- name: Checkout reference commit
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v2

- name: Checkout master
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0

- name: Get version
if: ${{ github.event_name != 'pull_request' }}
shell: bash
run: |
tag_check=$(git describe --exact-match `git rev-parse HEAD` | head -1)
echo "VERSION=$tag_check" >> $GITHUB_ENV
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Configure NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: ${{ env.NUGET_VERSION }}

- name: NuGet Restore
run: nuget restore ${{ env.SOLUTION }}

- name: Install dependencies
run: dotnet restore ${{env.SOLUTION}}

- name: Build
run: |
dotnet build `
--configuration ${{ env.CONFIG }} `
${{ env.SOLUTION }}
- name: Pack all nuspec files
if: ${{ github.event_name != 'pull_request' }}
shell: bash
working-directory: ${{ github.workspace }}
run: |
for nuspecFile in ./Source/**/*.nuspec
do
nuget pack $nuspecFile \
-Version ${{ env.VERSION }} \
-Properties Configuration=${{ env.CONFIG }} \
-OutputDirectory ${{ env.NUGET_OUTPUT }}
done
- name: Upload build artifact
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v2
with:
name: build_${{ env.PROJECT_NAME }}.${{ env.VERSION }}
path: ${{ github.workspace }}/${{ env.NUGET_OUTPUT }}
85 changes: 85 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Changelog generator

on:
push:
tags:
- '*'

jobs:
changelog_generator:
name: Changelog Generator
runs-on: ubuntu-latest
env:
branch: master
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set local user
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Get tag branch
run: |
branch_check=$(git branch -r --contains $(git rev-parse $GITHUB_REF~0) | sed 's/remotes\/origin\///' | sed 's/origin\///' | sed 's/develop//' | sed 's/* //' | sed -r '/^\s*$/d' | head -1)
echo $branch_check
if [[ $branch_check =~ ^(release|master)$ ]]; then
echo "Not correct branch. Allowed branches release and master."
exit 1
fi
echo "branch=$branch_check" >> $GITHUB_ENV
- uses: actions/checkout@v2
name: Checkout tag branch
with:
fetch-depth: 0
ref: ${{ env.branch }}

- name: Get tag
run: |
echo "Describe: $(git describe)"
echo "Rev parse: $(git rev-parse $GITHUB_REF~0)"
tag_check=$(git describe --exact-match `git rev-parse $GITHUB_REF~0`)
echo "tag=$tag_check" >> $GITHUB_ENV
- name: Install dependencies
run: |
rm -rf node_modules
npm install
- name: Generate changelog and update npm version
run: |
npm run release
- name: Remove tag
run: |
git tag -d ${{ env.tag }}
- name: Updating tags
run: |
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master
git tag -a ${{ env.tag }} -m "${{ env.tag }}"
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" --tag -f
- name: Pushing latest changes to master
run: |
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" ${{ env.branch }}:master
- name: Checkout master
run: |
git checkout master
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master
- name: Generate GitHub release notes
run: |
npm run github-release
continue-on-error: true
54 changes: 54 additions & 0 deletions .github/workflows/gitflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Git Flow

on:
workflow_run:
workflows: [ "Changelog generator" ]
types:
- completed
jobs:
gitflow:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Git Flow
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0

- name: Set local user
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Get latest tag
run: |
tag_check=$(git describe --exact-match `git rev-parse HEAD` | head -1)
echo "tag=$tag_check" >> $GITHUB_ENV
- name: Clear release branch
run: |
branch_check=$(git branch -r | grep release/${{ env.tag }} | sed 's/remotes\/origin\///' | sed 's/origin\///' | sed 's/* //' | sed -r '/^\s*$/d' | head -1)
if [[ $branch_check ]]; then
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" --delete $branch_check
fi
- name: Checkout develop and pull latest develop
run: |
git checkout develop
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" develop
- name: Pull master into develop
run: |
Conflicts=$(git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master -q --ff || echo "fatal: Not possible to fast-forward, aborting")
AbortingMsg='aborting'
if [[ "$Conflicts" == *"$AbortingMsg"* ]]; then
exit 1
fi
- name: Pushing develop to origin if pulling successfully
if: success()
run: |
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" develop:develop
Loading

0 comments on commit 82f8644

Please sign in to comment.