refactor: further updates #271
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] | |
jobs: | |
build: | |
name: Build, lint, and test on Node ${{ matrix.node-version }} and ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Setup Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: pnpm | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Lint | |
run: pnpm lint | |
- name: Build | |
run: pnpm build | |
- name: Test | |
run: pnpm test | |
release: | |
name: Run Semantic Release | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/master' }} | |
needs: [build] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm build | |
- name: Release | |
run: pnpm semantic-release | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GIT_AUTHOR_NAME: ${{ secrets.SEMANTIC_RELEASE_GIT_NAME }} | |
GIT_AUTHOR_EMAIL: ${{ secrets.SEMANTIC_RELEASE_GIT_EMAIL }} | |
GIT_COMMITTER_NAME: ${{ secrets.SEMANTIC_RELEASE_GIT_NAME }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.SEMANTIC_RELEASE_GIT_EMAIL }} | |
containerize: | |
name: Build and Push Docker Image | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./docker | |
if: ${{ github.ref == 'refs/heads/master' }} | |
needs: [release] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Build | |
run: | | |
docker build . --tag ghcr.io/${{ github.repository }}:latest | |
docker tag ghcr.io/${{ github.repository }}:latest ghcr.io/${{ github.repository }}:${{ github.sha }} | |
- name: Push | |
run: docker push ghcr.io/${{ github.repository }}:latest |