From af40ed3be89cf639e6a7b44d6a10c8bc3c3d4f02 Mon Sep 17 00:00:00 2001 From: Sacha STAFYNIAK Date: Thu, 28 Mar 2024 14:56:03 +0100 Subject: [PATCH] ci: update node and docker --- .../actions/build-template-action/script.sh | 2 +- .github/workflows/deploy.yml | 22 +++++++------- .github/workflows/release.yml | 29 ++++++++----------- .github/workflows/standard-version.yml | 13 +++------ Dockerfile | 4 +-- docker-compose.yml | 7 ++--- 6 files changed, 32 insertions(+), 45 deletions(-) diff --git a/.github/actions/build-template-action/script.sh b/.github/actions/build-template-action/script.sh index de95429..f384c0f 100755 --- a/.github/actions/build-template-action/script.sh +++ b/.github/actions/build-template-action/script.sh @@ -45,4 +45,4 @@ echo "- ${INPUT_PROJECT^} ${INPUT_TAG} template built :rocket:" >> $GITHUB_STEP_ # This step is important, it set the "filepath" output variable # Will be accessible in workflow -echo "::set-output name=filepath::${ARCHIVE}" +echo "filepath=${ARCHIVE}" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 159a0f8..f00e015 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,44 +15,42 @@ concurrency: jobs: docker-build: - # We can skip deployment by adding [skip] in the commit body - if: "!contains(github.event.head_commit.message, '[skip]')" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up dockertags run: | echo "dockertags=digisquad/cssninja.dokto-demo:latest" >> $GITHUB_ENV - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push id: docker_build - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 timeout-minutes: 60 with: push: true tags: ${{ env.dockertags }} - cache-from: type=registry,ref=${{ env.dockertags }} - cache-to: type=inline + cache-from: type=gha + cache-to: type=gha,mode=max deploy: runs-on: ubuntu-latest needs: [docker-build] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Prepare uses: appleboy/ssh-action@master with: @@ -80,5 +78,5 @@ jobs: script_stop: true script: | cd ${{ secrets.HOST_DIRECTORY }} - docker-compose pull - docker-compose up -d --force-recreate --remove-orphans + docker compose pull + docker compose up -d --force-recreate --remove-orphans diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7845f2..f25599d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,16 +7,11 @@ on: jobs: release: - # setup strategy matrix, so we can share same pnpm cache - strategy: - matrix: - os: [ubuntu-latest] - node-version: [18] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: # Checkout action retreive the source (git clone) - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # needed to retreive all git history @@ -24,9 +19,9 @@ jobs: - run: corepack enable # Setup pnpm with cache - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: "pnpm" # Compute tag and capitalized product name @@ -34,9 +29,9 @@ jobs: name: release meta run: | project=${GITHUB_REPOSITORY#*/} - echo ::set-output name=project::${project} - echo ::set-output name=project-capitalized::${project^} - echo ::set-output name=tag::${GITHUB_REF#refs/tags/} + echo "PROJECT=${project}" >> "$GITHUB_OUTPUT" + echo "PROJECT_CAP=${project^}" >> "$GITHUB_OUTPUT" + echo "TAG=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" # This is where we generate releases assets. # It use a github action in the current directory @@ -46,8 +41,8 @@ jobs: name: build release template uses: ./.github/actions/build-template-action with: - tag: ${{ steps.meta.outputs.tag }} - project: ${{ steps.meta.outputs.project }} + tag: ${{ steps.meta.outputs.TAG }} + project: ${{ steps.meta.outputs.PROJECT }} # We re-generate the changelog using a subset of standard-version # The content is generated in a temp /CHANGELOG_RELEASE.md file @@ -61,11 +56,11 @@ jobs: # Prepare the draft github release - id: create_release name: create github draft release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: # Use outputs from meta and changelog - tag_name: ${{ steps.meta.outputs.tag }} - name: ${{ steps.meta.outputs.project-capitalized }} ${{ steps.meta.outputs.tag }} + tag_name: ${{ steps.meta.outputs.TAG }} + name: ${{ steps.meta.outputs.PROJECT_CAP }} ${{ steps.meta.outputs.TAG }} body_path: ${{ github.workspace }}/CHANGELOG_RELEASE.md prerelease: false # The draft is required to allow file upload diff --git a/.github/workflows/standard-version.yml b/.github/workflows/standard-version.yml index fd462be..ae4acf2 100644 --- a/.github/workflows/standard-version.yml +++ b/.github/workflows/standard-version.yml @@ -11,16 +11,11 @@ on: jobs: standard-version: - # setup strategy matrix, so we can share same pnpm cache - strategy: - matrix: - os: [ubuntu-latest] - node-version: [18] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: # Checkout action retreive the source (git clone) - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # needed to retreive all git history token: ${{ secrets.APP_GITHUB_TOKEN }} @@ -29,9 +24,9 @@ jobs: - run: corepack enable # Setup pnpm with cache - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: "pnpm" # Run "standard-version", which may create a new tag diff --git a/Dockerfile b/Dockerfile index 3aa5575..41f1742 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/node:18 AS build +FROM bitnami/node:20 AS build WORKDIR /app RUN corepack enable @@ -12,7 +12,7 @@ COPY . . RUN pnpm build -FROM bitnami/nginx:1.22 AS prod +FROM bitnami/nginx:1.25 AS prod WORKDIR /app COPY --from=build /app/dist . diff --git a/docker-compose.yml b/docker-compose.yml index 05826f0..e9e57a3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,6 @@ -version: '3.7' +networks: + cssninja-services: + external: true services: dokto-demo: @@ -18,6 +20,3 @@ services: traefik.http.routers.dokto-demo-https.entrypoints: 'https' traefik.http.routers.dokto-demo-https.tls.certresolver: 'http' -networks: - cssninja-services: - external: true