Code Improvements #49
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
Setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bundled Node Version | |
run: | | |
echo "Node version: $(which node):$(node -v)" | |
echo "NPM version: $(which npm):$(npm -v)" | |
- uses: volta-cli/action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Project Node Version | |
run: | | |
echo "Node version: $(which node):$(node -v)" | |
echo "NPM version: $(which npm):$(npm -v)" | |
Build: | |
needs: [Setup] | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: volta-cli/action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: npm-install-v3-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-install-v3- | |
- name: Install Dependencies | |
run: npm ci | |
- name: Type Check | |
run: npm run typecheck | |
- name: Lint | |
run: npm run lint | |
- name: Build | |
run: npm run build | |
- if: github.event_name == 'push' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-art | |
path: dist | |
Deploy: | |
needs: [Build] | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get commit message | |
id: get_commit_message | |
run: | | |
COMMIT_MESSAGE_HEADER=$(git log -1 --pretty=%B | head -n 1 | sed "s/#/PR#/") | |
echo "header=${COMMIT_MESSAGE_HEADER}" >> $GITHUB_OUTPUT | |
- name: Cloning awesomehub/awesomehub.github.io | |
uses: actions/checkout@v4 | |
with: | |
repository: awesomehub/awesomehub.github.io | |
token: ${{ secrets.PAT }} | |
path: deploy | |
- name: Prepare repository | |
run: rm -r deploy/dist/* | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-art | |
path: deploy/dist | |
- name: Create deploy pull request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
branch: staging | |
path: deploy | |
token: ${{ secrets.PAT }} | |
commit-message: ${{ steps.get_commit_message.outputs.header }} ${{ github.event.head_commit.url }} | |
title: ${{ steps.get_commit_message.outputs.header }} | |
body: | | |
## Build Information | |
- ### Action | |
${{ github.workflow }} [#${{ github.run_number }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
- ### Commit | |
${{ steps.get_commit_message.outputs.header }} ${{ github.event.head_commit.url }} | |
- ### Author | |
@${{ github.actor }} | |
--- | |
> :rocket: *This report is autogenerated, any changes made will be overwrittten with the next commit.* | |
labels: | | |
deploy | |
automated | |
assignees: ${{ github.actor }} |