Skip to content

Commit

Permalink
ci: add GitHub workflows for pull request and release
Browse files Browse the repository at this point in the history
  • Loading branch information
NickSettler committed Oct 13, 2023
1 parent 4977309 commit be072bb
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
assignees:
- "NickSettler"
labels:
- "build"
open-pull-requests-limit: 10
53 changes: 53 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Lint And Build

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn install --freeze-lockfile

- name: Lint
run: yarn lint

build:
name: Build
runs-on: ubuntu-latest
needs: [lint]
steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install --freeze-lockfile

- name: Build
run: yarn build

- name: Archive production artifacts
if: githmkdiub.event.pull_request.merged == true
uses: actions/upload-artifact@v3
with:
name: build
path: |
build
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release

on:
release:
types:
- published

env:
REACT_APP_API_URL: ${{ secrets.REACT_APP_API_URL }}

jobs:
build_backend:
name: Build backend
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
tags: nicksettler/iis-frontend:${{ github.event.release.tag_name }}
build-args: |
REACT_APP_API_URL=${{ secrets.REACT_APP_API_URL }}
secrets: |
"REACT_APP_API_URL=${{ secrets.REACT_APP_API_URL }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# compiled output
/dist
/build
/node_modules

# Logs
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"lint": "eslint \"{src,apps,libs,test}/**/*.{ts,tsx,js,jsx}\" --fix"
},
"eslintConfig": {
"extends": [
Expand Down

0 comments on commit be072bb

Please sign in to comment.