Update dependency typescript to v4.9.5 #23
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: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+*' | |
pull_request: | |
branches: ['main'] | |
env: | |
REGISTRY: demery | |
IMAGE_NAME: docker-react | |
NODE_VERSION: 18.18.0 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install packages | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Test | |
run: npm t | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: | | |
dist | |
bin | |
Dockerfile | |
.dockerignore | |
nginx.conf | |
docker-react-entrypoint.sh | |
.npmignore | |
package*.json | |
README.md | |
publish-npm: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: nowsprinting/check-version-format-action@v3 | |
id: version | |
with: | |
prefix: 'v' | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifacts | |
if: steps.version.outputs.is_valid == 'true' | |
- name: set package json version | |
uses: jaywcjlove/github-action-package@main | |
with: | |
data: | | |
{ | |
"version": "${{steps.version.outputs.full_without_prefix}}" | |
} | |
if: steps.version.outputs.is_valid == 'true' | |
- name: Configure node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
if: steps.version.outputs.is_valid == 'true' | |
- name: Authenticate with npm | |
run: echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" > ~/.npmrc | |
if: steps.version.outputs.is_valid == 'true' | |
- name: Install packages | |
run: npm ci --omit=dev | |
if: steps.version.outputs.is_valid == 'true' | |
- name: Publish to npm (stable channel) | |
run: npm publish --access public | |
if: steps.version.outputs.is_valid == 'true' && steps.version.outputs.is_stable == 'true' | |
- name: Publish to npm (beta channel) | |
run: npm publish --access public --tag beta | |
if: steps.version.outputs.is_valid == 'true' && steps.version.outputs.is_stable == 'false' | |
publish-docker: | |
needs: publish-npm | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: nowsprinting/check-version-format-action@v3 | |
id: version | |
with: | |
prefix: 'v' | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifacts | |
if: steps.version.outputs.is_valid == 'true' | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
if: steps.version.outputs.is_valid == 'true' | |
- name: Install packages | |
run: npm ci --omit=dev | |
if: steps.version.outputs.is_valid == 'true' | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
flavor: | | |
latest=${{ steps.version.outputs.is_stable == 'true' && 'true' || 'false' }} | |
if: steps.version.outputs.is_valid == 'true' | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
DOCKER_REACT_VERSION=${{ steps.version.outputs.full }} | |
if: steps.version.outputs.is_valid == 'true' |