Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
eq19 committed Jul 6, 2023
1 parent 26b3cd5 commit c8ec381
Show file tree
Hide file tree
Showing 6 changed files with 281 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/reserves/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '38 3 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'ruby' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
83 changes: 83 additions & 0 deletions .github/workflows/reserves/matching.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI

on:
push:
branches: [develop]
pull_request:
branches: [develop]

jobs:
checkout:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.matching.outputs.version }}
steps:
- uses: actions/checkout@main
- uses: rundocs/checkout@master
- name: Match the commit message whether to Release!
run: |
MESSAGE=$(git log -1 --format="%s")
if [[ ${MESSAGE} =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "::set-output name=version::${MESSAGE:1}"
fi
id: matching
if: ${{ github.event_name == 'push' }}
release:
runs-on: ubuntu-latest
needs: checkout
if: ${{ needs.checkout.outputs.version }}
env:
VERSION: ${{ needs.checkout.outputs.version }}
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- uses: actions/setup-node@main
- uses: actions/setup-ruby@main

- name: Generate changelog and Auto update version!
run: |
LAST_TAG=$(git describe --tags --abbrev=0)
git log ${LAST_TAG}..HEAD --no-merges --format="- %h %s @%an" > action.changelog.md
sed -i "s/${LAST_TAG:1}/${VERSION}/g" jekyll-rtd-theme.gemspec
sed -i "s/${LAST_TAG:1}/${VERSION}/g" _includes/rest/defaults.liquid
- name: Prettier check and Build theme assets!
run: |
npm install
npm run format && npm run build
- name: Save changes!
run: |
git remote set-url origin "https://${GITHUB_ACTOR}:${{ secrets.AUTH_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "💎 v${VERSION}" && git push
- name: Create release!
uses: actions/create-release@main
with:
release_name: ${{ needs.checkout.outputs.version }}
tag_name: v${{ needs.checkout.outputs.version }}
commitish: ${{ github.ref }}
body_path: action.changelog.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Configure gem credentials and Build gemspec!
run: |
CONFIG=${HOME}/.gem/credentials
mkdir -p ${HOME}/.gem && touch ${CONFIG} && chmod 0600 ${CONFIG}
echo "---" > ${CONFIG}
echo ":github: Bearer ${GITHUB_TOKEN}" >> ${CONFIG}
echo ":rubygems_api_key: ${RUBYGEMS_AUTH_TOKEN}" >> ${CONFIG}
gem build *.gemspec
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUBYGEMS_AUTH_TOKEN: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}

- name: Publish rubygems!
run: |
gem push *.gem
gem push --KEY github --host https://rubygems.pkg.github.com/${{ github.repository_owner }} *.gem
37 changes: 37 additions & 0 deletions .github/workflows/reserves/test_of_push_and_pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Tests of push & pull"

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
FILENAME: README.md

jobs:
tests:
name: 'Validate README.md changes'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install dependencies
run: python -m pip install -r scripts/requirements.txt

- name: Validate Markdown format
run: python scripts/validate/format.py ${FILENAME}

- name: Validate pull request changes
run: scripts/github_pull_request.sh ${{ github.repository }} ${{ github.event.pull_request.number }} ${FILENAME}
if: github.event_name == 'pull_request'

- name: Checking if push changes are duplicated
run: python scripts/validate/links.py ${FILENAME} --only_duplicate_links_checker
if: github.event_name == 'push'
29 changes: 29 additions & 0 deletions .github/workflows/reserves/test_of_validate_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Tests of validate package"

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
unittest:
name: 'Run tests of validate package'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install dependencies
run: python -m pip install -r scripts/requirements.txt

- name: Run Unittest
run: |
cd scripts
python -m unittest discover tests/ --verbose
34 changes: 34 additions & 0 deletions .github/workflows/reserves/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update dependencies

on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch: {}

jobs:
update:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'

- name: script/update
run: script/update

- name: script/build
run: script/build

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: Update dependencies
title: Update dependencies
28 changes: 28 additions & 0 deletions .github/workflows/reserves/validate_links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Validate links"

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

env:
FILENAME: README.md

jobs:
validate_links:
name: 'Check all links are working'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install dependencies
run: python -m pip install -r scripts/requirements.txt

- name: Validate all links from README.md
run: python scripts/validate/links.py ${FILENAME}

0 comments on commit c8ec381

Please sign in to comment.