fix: contributor name #30
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: Dev Node CI | |
env: | |
node-version: 18 | |
yarn-version: 4.1.0 | |
on: | |
push: | |
branches: | |
- "develop" | |
jobs: | |
cache-dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Access repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node-version }} | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Set Yarn Version | |
run: corepack prepare yarn@${{ env.yarn-version }} --activate | |
- name: Get Yarn cache directory | |
id: yarn-cache-dir | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Cache Yarn dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.yarn-cache-dir.outputs.dir }} | |
.yarn/cache | |
.yarn/patches | |
.yarn/plugins | |
.yarn/releases | |
.yarn/sdks | |
.yarn/versions | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# Regenerate the lockfile explicitly | |
- name: Update Lockfile | |
run: yarn install --mode=update-lockfile | |
# actual installation | |
- name: Install dependencies | |
run: yarn install --mode=skip-build | |
- name: Copy Shared Package | |
run: | | |
cp -r shared server/node_modules/ | |
test: | |
runs-on: ubuntu-latest | |
needs: cache-dependencies | |
steps: | |
- name: Access repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node-version }} | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Set Yarn Version | |
run: corepack prepare yarn@${{ env.yarn-version }} --activate | |
- uses: ./.github/actions/test | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
steps: | |
- name: Access repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node-version }} | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Set Yarn Version | |
run: corepack prepare yarn@${{ env.yarn-version }} --activate | |
- name: Get Yarn cache directory | |
id: yarn-cache-dir | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Cache Yarn dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.yarn-cache-dir.outputs.dir }} | |
.yarn/cache | |
.yarn/patches | |
.yarn/plugins | |
.yarn/releases | |
.yarn/sdks | |
.yarn/versions | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# Regenerate the lockfile explicitly | |
- name: Update Lockfile | |
run: yarn install --mode=update-lockfile | |
# actual installation | |
- name: Install dependencies | |
run: yarn install --mode=skip-build | |
- name: Build | |
run: yarn build | |
- name: Upload client build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-client-develop | |
path: client/dist | |
- name: Upload server build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-server-develop | |
path: server/dist | |
check-docker-credentials: | |
runs-on: ubuntu-latest | |
needs: build | |
outputs: | |
defined: ${{ steps.username.outputs.defined == 'true' && steps.password.outputs.defined == 'true' }} | |
steps: | |
- name: Access repository | |
uses: actions/checkout@v4 | |
- name: Check if has username | |
id: username | |
uses: ./.github/actions/check-secret | |
with: | |
secret: ${{ secrets.DOCKER_USERNAME }} | |
- name: Check if has password | |
id: password | |
uses: ./.github/actions/check-secret | |
with: | |
secret: ${{ secrets.DOCKER_PASSWORD }} | |
publish-docker-image: | |
runs-on: ubuntu-latest | |
if: needs.check-docker-credentials.outputs.defined == 'true' | |
needs: | |
- check-docker-credentials | |
steps: | |
- name: Access repository | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-client-develop | |
path: client/dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-server-develop | |
path: server/dist | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: "olzzon/${{ github.event.repository.name }}" | |
tags: | | |
type=ref,event=branch | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |