Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JooLuiz committed Jul 3, 2024
0 parents commit 8c81491
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Create Tag and Release

on:
push:
branches:
- main

jobs:
create-tag-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Get the version from package.json
id: get_version
run: |
version=$(jq -r '.version' package.json)
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Generate release notes
id: generate_release_notes
run: |
last_tag=$(git describe --tags --abbrev=0)
git log "$last_tag"..HEAD --pretty=format:'* [%h] - %s' --abbrev-commit > release_notes.md
release_notes=$(<release_notes.md)
# Ensure the notes are properly escaped and formatted for GitHub Actions
release_notes="${release_notes//'%'/'%25'}"
release_notes="${release_notes//$'\n'/'%0A'}"
release_notes="${release_notes//$'\r'/'%0D'}"
echo "notes=$release_notes" >> "$GITHUB_OUTPUT"
- name: Create GitHub tag
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TAG_TOKEN }}
run: |
version=${{ steps.get_version.outputs.version }}
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git tag -a "v$version" -m "Release version $version"
git push origin "v$version"
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TAG_TOKEN }}
with:
tag_name: "v${{ steps.get_version.outputs.version }}"
release_name: "v${{ steps.get_version.outputs.version }}"
body: "${{ steps.generate_release_notes.outputs.notes }}"
draft: false
prerelease: false
48 changes: 48 additions & 0 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Validate PR

on:
pull_request:
branches:
- main

jobs:
validate-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # Ensure the entire history is fetched

- name: Fetch main branch
run: git fetch origin main

- name: Check for required file changes
id: file_changes
run: |
# Get the list of files changed in the PR
files=$(git diff --name-only origin/main...HEAD)
# Initialize variables
changelog_changed=false
packagejson_changed=false
# Check if the required files are in the list of changed files
for file in $files; do
if [ "$file" == "CHANGELOG.md" ]; then
changelog_changed=true
fi
if [ "$file" == "package.json" ]; then
packagejson_changed=true
fi
done
# Set output variables
echo "changelog_changed=$changelog_changed" >> "$GITHUB_OUTPUT"
echo "packagejson_changed=$packagejson_changed" >> "$GITHUB_OUTPUT"
- name: Ensure required files are changed
if: steps.file_changes.outputs.changelog_changed == 'false' || steps.file_changes.outputs.packagejson_changed == 'false'
run: |
echo "ERROR: Both CHANGELOG.md and package.json must be modified in this PR."
exit 1
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased] - yyyy-mm-dd

### Added

- Adding github actions, changelog and readme files.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 João Luiz de Castro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Simpler

![Node.js](https://img.shields.io/badge/Node.js-v14.17.3-green)
![License](https://img.shields.io/badge/license-MIT-blue)

Simpler é um servidor Node.js simples, projetado para fornecer uma base para iniciar rapidamente seus projetos de servidor.

## Licença

Este projeto está licenciado sob a Licença MIT. Veja o arquivo [LICENSE](LICENSE) para mais detalhes.

# Outras versões

[Readme in Portuguese (PT-BR)](README.pt-br.md)
14 changes: 14 additions & 0 deletions README.pt-br.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Simpler

![Node.js](https://img.shields.io/badge/Node.js-v14.17.3-green)
![License](https://img.shields.io/badge/license-MIT-blue)

Simpler is a simple Node.js server, designed to rapidly provide a base to start your server projects.

## License

This project is licensed under the MID license. Check file [LICENSE](LICENSE) for more details.

# Other versions

[Readme em inglês (EN)](README.md)

0 comments on commit 8c81491

Please sign in to comment.