-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #2 Replace circleci test with gitlab actions build * #2 Migrate npm publish to github actions * #2 Remove version from package.json and instead inject in ci based on tag * #2 Add missing quotes when setting package version * #2 Migrate dockerhub push job from circleci to github actions * #2 Replace deprecated --production with --omit=dev for npm installs * #2 Remove docker buildx actions * #2 Add debug step printing directory contents * #2 Use local context for build * #2 Add missing script to build artifacts * #2 Add missng nginx.conf to artifacts * #2 Fix image name and job dependencies
- Loading branch information
1 parent
62afb9b
commit 3bbb792
Showing
6 changed files
with
157 additions
and
168 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.circleci | ||
.github | ||
bin | ||
cli | ||
dist | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
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' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
# Ignore source & configuration code | ||
src | ||
tsconfig.json | ||
prettier.config.cjs | ||
sample.joi.schema.js | ||
.github | ||
|
||
# Ignore docker-related files | ||
Dockerfile | ||
.dockerignore | ||
docker-react-entrypoint.sh | ||
nginx.conf | ||
|
||
# Ignore nix development flakes | ||
flake.* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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