Skip to content

Commit

Permalink
build: new workflow
Browse files Browse the repository at this point in the history
updated workflow with semantic-release.
  • Loading branch information
mrdcvlsc committed Jul 1, 2023
1 parent 23b82e5 commit a68d4e6
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 4 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: format

# depends of tests.yml
on:
workflow_run:
workflows: [tests]
types: [completed]

jobs:
format-code:
runs-on: ubuntu-latest

permissions:
contents: write

if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Email
run: git config --local user.email [email protected]

- name: Configure Name
run: git config --local user.name format.yml

- name: Git Status
run: git status

- name: Format Code Style
run: npm run format

- name: Stage Changes
continue-on-error: true
run: git add .

- name: Save Changes
continue-on-error: true
run: git commit -m "[Auto-format code on push]" -m "Formatted the last commit -> '${{ github.event.head_commit.message }}'"

- name: Push Changes
continue-on-error: true
run: git push --force

- name: Done
run: echo done formatting files.

format-requirements-failed:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: rquirements failed
run: echo the tests failed
- name: force fail workflow
run: exit 1
10 changes: 6 additions & 4 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fetch-depth: 0

- name: Lint Code Base
uses: super-linter/super-linter@v4
uses: super-linter/super-linter@v5
env:
# https://github.com/super-linter/super-linter#environment-variables

Expand All @@ -28,18 +28,20 @@ jobs:

# this decides whether Super Linter should lint the whole codebase
# or just the changes introduced with that commit.
VALIDATE_ALL_CODEBASE: false
VALIDATE_ALL_CODEBASE: true

# to add a specific language linter,the format is: VALIDATE_{LANGUAGE}_{LINTER}
# setting to true will run only the linter.
# setting to false will run all linters except it.
VALIDATE_JAVASCRIPT_ES: true
JAVASCRIPT_DEFAULT_STYLE: standard/prettier

# VALIDATE_PYTHON_BLACK: true
VALIDATE_JAVASCRIPT_ES: true
# VALIDATE_HTML: true
# VALIDATE_CSS: true

# where your linter config files should go like;
# .prettierrc.json, .clang-fromat, .eslintrc.yml, .htmlhintrc, etc.
# .clang-fromat, .eslintrc.yml, .htmlhintrc, etc.
# the value is default is .github/linters/
# LINTER_RULES_PATH: /

Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: release

on:
workflow_run:
workflows: [format]
types: [completed]

permissions:
contents: read # for checkout

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install dependencies
run: npm clean-install

- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release

release-requirements-failed:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: requirements failed
run: echo the formatting workflow did not run
- name: force fail release workflow
run: exit 1

0 comments on commit a68d4e6

Please sign in to comment.