Skip to content

Commit

Permalink
feat: add base workspace files
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm committed Nov 8, 2023
1 parent a11747a commit 79487e8
Show file tree
Hide file tree
Showing 13 changed files with 375 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @AliMD
35 changes: 35 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: github-actions
directory: /
open-pull-requests-limit: 20
reviewers:
- AliMD
schedule:
interval: daily
labels:
- ci
- priority-low
- maintenance
groups:
github-actions:
patterns:
- '*'

- package-ecosystem: docker
directory: /**/Dockerfile
open-pull-requests-limit: 20
reviewers:
- AliMD
schedule:
interval: daily
labels:
- ci
- priority-low
- maintenance
# groups:
# github-actions:
# patterns:
# - '*'
90 changes: 90 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
- name: 'bug-report'
color: ee0811
description: 'Inconsistencies or issues which will cause a problem for users or implementors.'
- name: 'feature-request'
color: 0e9a26
description: 'Request new features or options.'

- name: 'breaking-change'
color: ee0701
description: 'A change that changes the API or breaks backward compatibility for users.'
- name: 'bugfix'
color: ee0701
description: 'Inconsistencies or issues which will cause a problem for users or implementors.'
- name: 'documentation'
color: 0052cc
description: 'Solely about the documentation of the project.'
- name: 'enhancement'
color: 1d76db
description: 'Enhancement of the code, not introducing new features.'
- name: 'refactor'
color: 1d76db
description: 'Updating the code with simpler, easier to understand or more efficient syntax or methods.'
- name: 'performance'
color: 1d76db
description: 'Improving performance of the project, not introducing new features.'
- name: 'new-feature'
color: 0e8a16
description: 'New features or options.'
- name: 'maintenance'
color: 2af79e
description: 'Generic maintenance tasks.'
- name: 'ci'
color: 1d76db
description: 'Work that improves the continuous integration.'
- name: 'dependencies'
color: 1d76db
description: 'Change in project dependencies.'

- name: 'in-progress'
color: fbca04
description: 'Issue is currently being worked on by a developer.'
- name: 'stale'
color: fef2c0
description: 'No activity for quite some time.'
- name: 'no-stale'
color: fef2c0
description: 'This is exempt from the stale bot.'
- name: 'auto-closed'
color: fef2c0
description: 'No activity for quite some time.'

- name: 'security'
color: ee0701
description: 'Addressing a vulnerability or security risk in this project.'
- name: 'incomplete'
color: fef2c0
description: 'Missing information.'
- name: 'invalid'
color: fef2c0
description: "This is off-topic, spam, or otherwise doesn't apply to this project."

- name: 'good first issue'
color: 0e8a16
description: 'Good first issue for people wanting to contribute to this project.'
- name: 'help-wanted'
color: 0e8a16
description: 'We need some extra helping hands or expertise in order to resolve this!'

- name: 'priority-critical'
color: ee0701
description: 'Must be addressed as soon as possible.'
- name: 'priority-high'
color: b60205
description: 'After critical issues are fixed, these should be dealt with before any further issues.'
- name: 'priority-medium'
color: 0e8a16
description: 'This issue may be useful, and needs some attention.'
- name: 'priority-low'
color: e4ea8a
description: 'Nice addition, maybe... someday...'

- name: 'major'
color: b60205
description: 'This PR causes a major bump in the version number.'
- name: 'minor'
color: 0e8a16
description: 'This PR causes a minor bump in the version number.'
- name: 'release'
color: 5319E7
description: 'Release PR from next to main.'
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Description

<!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->
111 changes: 111 additions & 0 deletions .github/workflows/publish-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: Build & Publish Containers

on:
workflow_dispatch:

push:
branches:
- main

pull_request:

env:
REGISTRY: ghcr.io
USER: alwatr

jobs:
build:
if: github.repository_owner == 'Alwatr'

name: Build & Publish Containers
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- name: nginx
path: nginx

- name: nginx-pwa
path: nginx-pwa

- name: nginx-ws
path: nginx-ws

permissions:
contents: read
packages: write
id-token: write

steps:
- name: ⤵️ Checkout repository
uses: actions/[email protected]

- name: ❔ Check Container files changed
id: file_change
uses: dorny/[email protected]
with:
filters: |
container_folder:
./${{ matrix.path }}/*
- name: 🏗 Extract version from dockerfile
if: ${{ steps.file_change.outputs.container_folder == 'true' }}
id: version
run: |
version_full=$(grep 'cloud.alwatr.image.version.full' ./${{ matrix.path }}/Dockerfile | cut -d'"' -f2)
version_short=$(grep 'cloud.alwatr.image.version.short' ./${{ matrix.path }}/Dockerfile | cut -d'"' -f2)
echo "version_full=$version_full" >> $GITHUB_OUTPUT
echo "version_short=$version_short" >> $GITHUB_OUTPUT
echo "version_full: $version_full"
echo "version_short: $version_short"
- name: 🏗 Install cosign
if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder == 'true' }}
uses: sigstore/[email protected]

- name: 🏗 Setup Docker Buildx
if: ${{ steps.file_change.outputs.container_folder == 'true' }}
uses: docker/[email protected]

- name: 🏗 Cache Docker Layers
if: ${{ steps.file_change.outputs.container_folder == 'true' }}
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: container-${{ matrix.name }}

- name: 🏗 Log into registry ${{env.REGISTRY}}
if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder == 'true' }}
uses: docker/[email protected]
with:
registry: ${{env.REGISTRY}}
username: ${{github.repository_owner}}
password: ${{secrets.GITHUB_TOKEN}}

- name: 🚀 Build and push container image
if: ${{ steps.file_change.outputs.container_folder == 'true' }}
id: build_and_push
uses: docker/[email protected]
with:
context: ./${{matrix.path}}
push: ${{github.event_name != 'pull_request'}}
tags: |
${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.version.outputs.version_full}}
${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.version.outputs.version_short}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
BUILD_DATE=${{github.event.repository.updated_at}}
BUILD_REV=${{github.sha}}
- name: 🏗 Sign the image with GitHub OIDC Token
if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder == 'true' }}
env:
COSIGN_EXPERIMENTAL: 'true'
run: |
cosign sign --yes "${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.version.outputs.version_full}}@${{steps.build_and_push.outputs.digest}}"
cosign sign --yes "${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.version.outputs.version_short}}@${{steps.build_and_push.outputs.digest}}"
30 changes: 30 additions & 0 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: Sync labels

on:
workflow_dispatch:
push:
branches:
- main
- next
paths:
- .github/labels.yml

jobs:
labels:
name: Sync labels
runs-on: ubuntu-latest

permissions:
contents: read
issues: write

steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]

- name: 🚀 Run Label Syncer
uses: micnncim/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore

# OSX
.DS_STORE
.DS_Store
._*

# Windows
Thumbs.db
Desktop.ini

# Logs
*.log*

# Build
dist
build
.tsbuildinfo
*.map
*.d.ts
*.js
!*.config.js
!**/res/*.js

# Dependencies
node_modules
package-lock.json

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"bracketSpacing": false
}
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"davidanson.vscode-markdownlint",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"jgclark.vscode-todo-highlight",
"streetsidesoftware.code-spell-checker-persian",
"streetsidesoftware.code-spell-checker"
]
}
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"editor.wordWrapColumn": 120,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.useEditorConfig": true,
"files.associations": {
"*.mt": "routeros",
"*.conf.template": "nginx",
"ssh_config": "ssh_config",
"*.njk": "html",
"ssh-config": "ssh_config"
},
"markdownlint.ignore": ["**/CHANGELOG.md"],
"cSpell.language": "en,fa,fa-IR",
"cSpell.words": ["alwatr"],
"git.autoStash": true,
"githubPullRequests.ignoredPullRequestBranches": ["main", "next"]
}
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) 2023 Alwatr

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.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Alwatr Nginx

0 comments on commit 79487e8

Please sign in to comment.