-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
659 additions
and
1,286 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -29,6 +29,8 @@ jobs: | |
${{ runner.os }}-node- | ||
- name: 📦 Install dependencies | ||
run: npm ci | ||
- name: 🐳 Pull alpine image (for unit tests) | ||
run: docker pull alpine | ||
- name: ⏳ Run tests | ||
run: npm run test | ||
|
||
|
@@ -52,6 +54,8 @@ jobs: | |
${{ runner.os }}-node- | ||
- name: 📦 Install dependencies | ||
run: npm ci | ||
- name: 🐳 Pull alpine image (for unit tests) | ||
run: docker pull alpine | ||
- name: 🔍 Run linter | ||
run: npm run lint | ||
- name: ⚙️ Build project | ||
|
@@ -80,97 +84,6 @@ jobs: | |
- name: 🕵️♀️ Run license checker | ||
run: npm run license-check | ||
|
||
docker-image: | ||
name: Build Docker Image | ||
runs-on: ubuntu-latest | ||
env: | ||
PUSH_TO_DOCKERHUB: ${{ (github.repository != 'sebbo2002/js-template') && (secrets.DOCKERHUB_TOKEN != null) }} | ||
steps: | ||
- name: ☁️ Checkout | ||
uses: actions/checkout@v2 | ||
- name: 🔧 Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: 🔧 Set up Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@master | ||
with: | ||
version: "https://github.com/docker/buildx.git#67bd6f4dc82a9cd96f34133dab3f6f7af803bb14" | ||
driver-opts: image=moby/buildkit:master | ||
buildkitd-flags: --debug | ||
- name: 🔐 Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: 🔐 Login to DockerHub | ||
uses: docker/login-action@v1 | ||
if: ${{ env.PUSH_TO_DOCKERHUB == true }} | ||
with: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: ℹ️ Set Build Variables | ||
id: buildVars | ||
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S')" | ||
- name: 🪄 Build and push (1/2) | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
github-token: ${{ secrets.GH_TOKEN }} | ||
target: build-container | ||
builder: ${{ steps.buildx.outputs.name }} | ||
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/arm/v7,linux/arm/v6 | ||
pull: true | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:build-container-${{ github.sha }} | ||
cache-from: type=gha | ||
cache-to: type=gha | ||
- name: 🪄 Build and push (2/2) | ||
id: build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
github-token: ${{ secrets.GH_TOKEN }} | ||
builder: ${{ steps.buildx.outputs.name }} | ||
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/arm/v7,linux/arm/v6 | ||
pull: true | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
labels: | | ||
org.opencontainers.image.authors=${{ github.repository_owner }} | ||
org.opencontainers.image.created=${{ steps.buildVars.outputs.date }} | ||
org.opencontainers.image.ref.name=${{ github.ref }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
org.opencontainers.image.source=https://github.com/${{ github.repository }} | ||
cache-from: | | ||
type=gha | ||
type=registry,ref=ghcr.io/${{ github.repository }}:build-container-${{ github.sha }} | ||
type=registry,ref=ghcr.io/${{ github.repository }}:next | ||
type=registry,ref=ghcr.io/${{ github.repository }}:latest | ||
cache-to: type=gha | ||
- name: 🔄 Push container to DockerHub | ||
if: ${{ env.PUSH_TO_DOCKERHUB == true }} | ||
run: | | ||
docker pull $SOURCE | ||
docker tag $SOURCE $TARGET | ||
docker push $TARGET | ||
env: | ||
SOURCE: ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
TARGET: ${{ github.repository }}:${{ github.sha }} | ||
- name: 🏁 Boot-up Check | ||
if: github.repository != 'sebbo2002/js-template' | ||
run: | | ||
docker run --name "app" -d $IMAGE | ||
sleep 5 | ||
docker logs app | ||
docker exec app echo "Ok." | ||
docker stop app | ||
docker rm app | ||
env: | ||
IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
outputs: | ||
digest: ${{ steps.build.outputs.digest }} | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
|
@@ -180,7 +93,6 @@ jobs: | |
- coverage | ||
- tests | ||
- license-checker | ||
- docker-image | ||
if: ${{ github.repository != 'sebbo2002/js-template' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') }} | ||
steps: | ||
- name: ☁️ Checkout Project | ||
|
@@ -200,34 +112,8 @@ jobs: | |
run: npm ci | ||
- name: 📂 Create docs folder | ||
run: mkdir ./docs | ||
- name: 🔐 Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: 🔐 Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: ⬇️ Pull GitHub Containers | ||
id: github | ||
run: | | ||
docker pull "${IMAGE}@${DIGEST}" | ||
echo "::set-output name=image::${IMAGE}@${DIGEST}" | ||
env: | ||
IMAGE: ghcr.io/${{ github.repository }} | ||
DIGEST: ${{ needs.docker-image.outputs.digest }} | ||
- name: ⬇️ Pull Docker Hub Containers | ||
if: ${{ env.PUSH_TO_DOCKERHUB == true }} | ||
id: dockerhub | ||
run: | | ||
docker pull "${IMAGE}@${DIGEST}" | ||
echo "::set-output name=image::${IMAGE}@${DIGEST}" | ||
env: | ||
IMAGE: ${{ github.repository }} | ||
DIGEST: ${{ needs.docker-image.outputs.digest }} | ||
- name: 🐳 Pull alpine image (for unit tests) | ||
run: docker pull alpine | ||
- name: 🪄 Run semantic-release | ||
run: BRANCH=${GITHUB_REF#refs/heads/} npx semantic-release | ||
env: | ||
|
@@ -238,8 +124,6 @@ jobs: | |
GITHUB_NPM_TOKEN: ${{ secrets.GH_TOKEN }} | ||
PUBLIC_NPM_CONFIG_REGISTRY: https://registry.npmjs.org | ||
PUBLIC_NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
DOCKER_LOCAL_IMAGE_GH: ${{ steps.github.outputs.image }} | ||
DOCKER_LOCAL_IMAGE_DH: ${{ steps.dockerhub.outputs.image }} | ||
- name: 🔃 Merge main back into develop | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
uses: everlytic/[email protected] | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.